Giter VIP home page Giter VIP logo

mocks-server / main Goto Github PK

View Code? Open in Web Editor NEW
277.0 3.0 13.0 17.53 MB

Node.js mock server running live, interactive mocks in place of real APIs

Home Page: https://www.mocks-server.org

License: Apache License 2.0

JavaScript 94.13% Shell 0.06% Handlebars 0.30% HTML 0.62% CSS 0.22% TypeScript 4.66%
mock mock-server mocks-server development-tools rest-api api-rest nodejs command-line-interface command-line-app testing-tools

main's Introduction

Mocks Server logo

Build Status Coverage Quality Gate Downloads Renovate Last release Last commit License


Introduction

Node.js mock server running live, interactive mocks in place of real APIs. It makes able to define many different responses for a same route, so, you can change the whole mocked API behavior by simply changing the response of one or many routes while the server is running.

Usage

Define your mocked API routes in YAML, JSON, JavaScript or TypeScript files. Mocks Server loads them automatically and watches for changes. Defining routes using any of the available APIs is also possible.

Routes can be defined in many ways, from plain objects to plain text and even Express middlewares, and they can act in different ways also, from sending a response to proxy the request to another host.

Configuration

Configure the server simply modifying the configuration file at the root folder of your project, or use command line arguments, or even environment variables.

For changing options while it is running, you can also use any of the available integrations tools that enable live interactions with Mocks Server.

Integrations

Providing a Javascript API, an interactive command line interface and a REST API for changing the responses of the mocked API while it is running, it is easy to use both for development and testing. Tools providing integrations with other ecosystems are also available, such as Cypress commands.

Documentation

To check out docs, visit www.mocks-server.org.

Ecosystem

Project Status Description
main main-status Main distribution. It includes all plugins preinstalled
core core-status Pluggable core. It can be used programmatically also
plugin-admin-api plugin-admin-api-status Plugin providing an administration REST API
plugin-inquirer-cli plugin-inquirer-cli-status Plugin providing an administration interactive CLI
plugin-openapi plugin-openapi-status Plugin allowing to create routes and collections from OpenApi definitions
plugin-proxy plugin-proxy-status Plugin providing Proxy route handler
admin-api-client admin-api-client-status API client for plugin-admin-api
admin-api-client-data-provider admin-api-client-data-provider-status API client for plugin-admin-api built using data-provider
admin-api-paths admin-api-paths-status Definition of plugin-admin-api routes
cypress-commands cypress-commands-status Cypress commands to administrate Mocks Server
config config-status Provides configuration to core components and plugins
nested-collections nested-collections-status Nested collections manager. Used to provide alert namespaces to plugins
logger logger-status Winston-based logger with namespaces and events emitter

Contributing

Contributors are welcome. Please read the contributing guidelines and code of conduct.

main's People

Contributors

davidmhewitt avatar greenkeeper[bot] avatar javierbrea avatar methadata avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

main's Issues

ajv-errors fails validation

Describe the bug

Error loading ajv-errors dependency, validations won't be executed. Visit https://mocks-server.org/docs/how-to-fix-ajv-errors-installation for further info.: Unexpected token ':'
         SyntaxError: Unexpected token ':'
             at new Function (<anonymous>)
             at Ajv.compileSchema (/src/node_modules/@mocks-server/core/node_modules/ajv/dist/compile/index.js:90:30)...

This error is documented in https://www.mocks-server.org/docs/how-to-fix-ajv-errors-installation/ but none of the proposed solutions worked.

Only forcing both of these package versions fixed it:

        "ajv": "8.9.0",
        "ajv-errors": "3.0.0",

To Reproduce
Updating ajv to 8.9.10 and having "@mocks-server/main": "2.6.2"

Expected behavior
No errors happen on validation.

Cors options

It is desirable to expose all cors options, so users can provide filters to apply the middleware only to some requests, etc. The admin-api-plugin should also always apply cors, even when it is disabled globally.

Add `strictValidation` option

If provided, the validation should be more strict and mocks or routes containing validation errors should be completely ignored. It would be useful also to have a validation command that could be executed separately in order to check validations and return an error in case there are validation errors. This could be useful in pipelines, to be executed as a kind of linter, for example.

Create a mock server app inside a Nx monorepo

Is your feature request related to a problem? Please describe.
I would like to add the mock server to an Nx monorepo which includes some apps and libs. I would like to add as a new app then using the main.ts file I would like to start the mocksServer. I found a way using the MocksServer Core dependency, but also found it is archived. It is possible to access through the @mocks-server/main internal package?

const { Core } = require("@mocks-server/core");
const AdminApi = require("@mocks-server/plugin-admin-api");
const InquirerCli = require("@mocks-server/plugin-inquirer-cli");

const mocksServer = new Core({
  onlyProgrammaticOptions: false,
  plugins: [AdminApi, InquirerCli]
});

mocksServer
  .init({
    port: 3500,
    delay: 1000,
    log: "debug"
  })
  .then(server.start);

Describe the solution you'd like
Ability to use a Nx typescript based project in order to integrate into the Nx monorepo project. Could be a better approach to do it?

TypeScript type definitions

Hi, thanks for a great library! I have a question - have you considered creating a set of TypeScript type definitions for it? Or maybe someone has already created it, but I didn't find it?
Thank you very much for responding.

Async plugins register method

Currently, the register method of plugins is the only one which does not support asynchrony. It is desirable to allow plugins to return a Promise in the register method.

How could be possible to pass headers and query params to a mocked HTTP request

Is your feature request related to a problem? Please describe.
I would need to pass query params and headers to a mocked request, I tried to pass the params in the url but it is not possible because the mock-server failed.

Describe the solution you'd like
Would be great to have the possibility to pass them to the requests. I also have the same endpoint for two requests differentiated by HTTP query params grant_type

Avoid possible conflicts in alerts namespaces

It is desirable to avoid possible conflicts in alerts namespaces, so one plugin alerts methods couldn't impact on other pliguin alerts in case there is a coincidence in the beginning of their namespace.

Default import not working in nodejs

Importing @mocks-server/admin-api-client in node does not work. It works only if you import @mocks-server/admin-api-client/dist/index.cjs.

It is desirable to change the main property of the package.json to point to that file instead of the index.umd file, which should imported specifically when requiring this package directly in a script tag

Validator as a method in variant handlers

Currently, custom route handlers validators can be defined only as an ajv schema. It would be useful to allow defining validators as a function, that would receive the route variant. The function should return an string with errors or null in case the route variant is valid.

Add acceptance tests

The project currently has a good unit test coverage, but It is desirable to add also end-to-end tests. This tests should start really the mocks server and execute tests requesting really against the api.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: renovate.json
Error type: The renovate configuration file contains some invalid settings
Message: Invalid configuration option: node

`watchExtraFolders` option

Currently, node-watch only watches the mocks folder. If you are importing files outside this folder, changes in those files are not producing a "hot reload". It is desirable to allow to define extra folders to be watched.

Plugins approach

In order to improve the scalability of the project, the main package should only contain dependencies to "core" and other "plugins" that will be distributed by default with this main distribution.

Doing this, it would be easier to develop new "plugins", and maybe add them to this main distribution. Anyway, adding the possibility to develop "plugins" for adding new features to the core functionality will be a better approach for the project.

A possible approach to achieve this could be splitting the logic in next packages:

  • core - Responsible of:
    • Get user options. Should also provide a method to allow plugins adding their own options.
    • Expose methods for creating behaviors.
    • Expose methods for administration, such as change current behavior, change delay, change logs level, etc.
    • Expose getters for current behaviors and fixtures collections and models.
    • Emit events when a setting changes, the server is restarted, behaviors or fixtures are updated, etc.
    • Read mocks folder, register fixtures and create automatically default behavior.
    • Watch for file changes and update behaviors and fixtures when a change occurs.
    • Create http server serving mocks.
    • Expose a method for adding custom Routers to the server.
    • Emit events with server logs.
  • admin-api - Responsible of:
    • Registering the administration api as a new custom Router in the provided core.
    • Use core methods to change administration settings.
    • Use core getters to return administration settings.
    • Use core getters to return current behaviors and fixtures collections and models.
  • inquirer-cli - Responsible of:
    • Displaying the interactive CLI.
    • Use core methods to change administration settings.
    • Use core getters to display administration settings.
    • Use core getters to display current behaviors and fixtures number.
    • Refresh the CLI when corresponds, listening to core events.
  • main - Responsible of:
    • Create a new instantance of the "core", and create new instances of "admin-api" and "inquirer-cli" passing to them the core reference.
    • Start all pieces.

Here goes a draft:

const MocksServer = require("@mocks-server/core");
const AdminApi = require("@mocks-server/admin-api");
const InquirerCli = require("@mocks-server/inquirer-cli");

const mocksServer = new MocksServer();

// plugins add their own options to core;
const adminApi = new AdminApi(mocksServer);
const inquirerCli = new InquirerCli(mocksServer);

mocksServer.getOptions()
  .then(options => {
    // plugins are initialized with user options.
    // These is needed to allow them register custom Routes based on user options, etc., before server starts.
    return Promise.all([
      adminApi.init(options),
      inquirerCli.init(options)
    ]);
  })
  .then(() => {
    // mocks server is started
    return mocksServer.start();
  });

plugins API

Expose an API about plugins, allowing to list, start/stop them, install more, etc. This API should be also exposed also in the admin-api-plugin.

OpenApi validation

It is desirable to add a command (maybe a plugin) to validate the server responses using a OpenApi document, which would be a kind of "contract tests". Further investigation is needed in order to find the better approach to implement it.

Publish Postman API

It is desirable to publish a PostMan collection/workspace with the administration API specifications

`query` option to routes

It is desirable to allow to define different variants depending of values received as queryStrings. It needs a further investigation in order to decide which would be the better approach, as the main structure of the routes properties would change.

About API

Expose an about API providing information about current version, etc.

Installation error

In some projects, the package returns an error due to an installation bug:

internal/modules/cjs/loader.js:888
  throw err;
  ^

Error: Cannot find module 'ajv/dist/compile/codegen'
Require stack:
- /Users/javierbrea/proyectos/data-provider/axios/node_modules/ajv-errors/dist/index.js
- /Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/core/src/mocks/validations.js
- /Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/core/src/mocks/Mock.js
- /Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/core/src/mocks/helpers.js
- /Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/core/src/mocks/Mocks.js
- /Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/core/src/Core.js
- /Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/core/index.js
- /Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/main/lib/start.js
- /Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/main/bin/mocks-server
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
    at Function.Module._load (internal/modules/cjs/loader.js:730:27)
    at Module.require (internal/modules/cjs/loader.js:957:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/javierbrea/proyectos/data-provider/axios/node_modules/ajv-errors/dist/index.js:4:19)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/javierbrea/proyectos/data-provider/axios/node_modules/ajv-errors/dist/index.js',
    '/Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/core/src/mocks/validations.js',
    '/Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/core/src/mocks/Mock.js',
    '/Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/core/src/mocks/helpers.js',
    '/Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/core/src/mocks/Mocks.js',
    '/Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/core/src/Core.js',
    '/Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/core/index.js',
    '/Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/main/lib/start.js',
    '/Users/javierbrea/proyectos/data-provider/axios/node_modules/@mocks-server/main/bin/mocks-server'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1

How can I use babel without .babelrc with NextJS?

My stack is Next v12 and TypeScript; On v12, there is an SWC option that enables us to have a better performance in the app. To enable SWC, we have to remove the babel configuration to enable SWC. However, running the app without babel configuration is throwing out errors.

It is complaining that it cannot understand the es6 import statements.

How can I use babel without babelrc? Can we have some sort of babel configuration that is only available in the mocks.config.js?

Add swagger-ui

It is desirable to add OpenApi 3.0 api definitions, and Swagger UI, which could be available at the admin/swagger path.

Identify built-in plugins

When adding traces about loaded plugins, etc. built-in or native plugins should be differentiate from the installed ones.

Middleware for any http method as per documentation

Describe the bug
When trying the middleware example presented in the docs there is an error when starting up the server:

TypeError: this._router[METHODS[routeVariant.method]] is not a function at _routesVariants.forEach (.../node_modules/@mocks-server/core/src/mocks/Mock.js:34:49) at Array.forEach (<anonymous>) at Mock._initRouter (.../node_modules/@mocks-server/core/src/mocks/Mock.js:33:26) at new Mock (.../node_modules/@mocks-server/core/src/mocks/Mock.js:28:10) at _mocks._mocksDefinitions.map (.../node_modules/@mocks-server/core/src/mocks/Mocks.js:83:18) at Array.map (<anonymous>) at Mocks._processMocks (.../node_modules/@mocks-server/core/src/mocks/Mocks.js:81:8) at Mocks.load (.../node_modules/@mocks-server/core/src/mocks/Mocks.js:147:10) at Orchestrator._onLoadMocks (.../node_modules/@mocks-server/core/src/Orchestrator.js:54:19) at EventEmitter.emit (events.js:198:13)

To Reproduce
Use the content of the middlewares.js file in the documentation and add either of the routes to the 'base' mock setup.
When you start the server the above error will occur.
If you add method: "GET" to the route, it works, however it looks like a wildcard doesn't work for that field (*)

Expected behavior
The server loads and the middleware route fires on all requests

** Operating system, Node.js an npm versions, or browser version (please complete the following information):**

  • OS: macOS Catalina 10.15.7
  • Node.js: v10.21.0
  • npm: 6.14.4

`extraRoutesFolders` option

It is desirable to add an option to allow loading routes from extra folders. This is interesting in some scenarios, as in monorepos which may want to divide the code of the API mocks, for example. All of these extra folders should be also watched, and the babelRegister option should also work in them.

Option for filter routes

It is desirable to add a filter option to the default route handler. It should work in the same way that the filter option does in the proxy handlers. It should accept a function that would receive the req object. If the function returns true, or a resolved Promise, then the route would process the request, otherwise it won't.

This feature was originally proposed in #282

Change settings synchronously

Currently, changing settings is an async task, as it is made using events internally. It is desirable to provide a method for changing settings synchronously somehow, or at least provide feedback about when a setting has been really changed, because some plugins (are the plugin-admin-api) need to know when the setting has been changed in order to response to the API request.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @data-provider/axios to v5.0.2
  • chore(deps): update dependency @testing-library/cypress to v8.0.7
  • chore(deps): update pnpm/action-setup action to v2.2.4
  • fix(deps): update babel monorepo (@babel/core, @babel/eslint-parser, @babel/preset-env, @babel/preset-react, @babel/preset-typescript, @babel/register)
  • fix(deps): update dependency cross-fetch to v3.1.8
  • fix(deps): update dependency inquirer to v8.2.5
  • fix(deps): update dependency react-redux to v7.2.9
  • chore(deps): update dependency babel-loader to v8.3.0
  • chore(deps): update dependency eslint to v8.44.0
  • chore(deps): update dependency start-server-and-test to v1.15.4
  • chore(deps): update dependency typescript to v4.9.5
  • chore(deps): update dependency webpack to v5.88.1
  • chore(deps): update typescript-eslint monorepo to v5.61.0 (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • fix(deps): update dependency cosmiconfig to v7.1.0
  • fix(deps): update dependency swagger-ui-dist to v4.19.1
  • chore(deps): update actions/setup-node action to v3
  • chore(deps): update andstor/file-existence-action action to v2
  • chore(deps): update dependency @rollup/plugin-babel to v6
  • chore(deps): update dependency @rollup/plugin-commonjs to v23
  • chore(deps): update dependency @rollup/plugin-commonjs to v24
  • chore(deps): update dependency @rollup/plugin-commonjs to v25
  • chore(deps): update dependency @rollup/plugin-node-resolve to v14
  • chore(deps): update dependency @rollup/plugin-node-resolve to v15
  • chore(deps): update dependency @rollup/plugin-typescript to v10
  • chore(deps): update dependency @rollup/plugin-typescript to v11
  • chore(deps): update dependency @rollup/plugin-typescript to v9
  • chore(deps): update dependency @testing-library/cypress to v9
  • chore(deps): update dependency axios to v1
  • chore(deps): update dependency babel-loader to v9
  • chore(deps): update dependency babel-plugin-module-resolver to v5
  • chore(deps): update dependency cypress to v10
  • chore(deps): update dependency cypress to v11
  • chore(deps): update dependency cypress to v12
  • chore(deps): update dependency cypress-fail-fast to v4
  • chore(deps): update dependency cypress-fail-fast to v5
  • chore(deps): update dependency cypress-fail-fast to v6
  • chore(deps): update dependency cypress-fail-fast to v7
  • chore(deps): update dependency eslint-plugin-jest to v27
  • chore(deps): update dependency eslint-plugin-no-only-tests to v3
  • chore(deps): update dependency husky to v8
  • chore(deps): update dependency lint-staged to v13
  • chore(deps): update dependency prettier to v3
  • chore(deps): update dependency react-scripts to v5
  • chore(deps): update dependency rollup to v3
  • chore(deps): update dependency serve to v14
  • chore(deps): update dependency sinon to v14
  • chore(deps): update dependency sinon to v15
  • chore(deps): update dependency start-server-and-test to v2
  • chore(deps): update dependency typescript to v5
  • chore(deps): update dependency wait-on to v7
  • chore(deps): update jest monorepo to v28 (major) (babel-jest, jest)
  • chore(deps): update jest monorepo to v29 (major) (babel-jest, jest)
  • chore(deps): update nrwl monorepo to v14 (major) (@nrwl/cli, @nrwl/eslint-plugin-nx, @nrwl/tao, @nrwl/workspace)
  • chore(deps): update nrwl monorepo to v15 (major) (@nrwl/cli, @nrwl/eslint-plugin-nx, @nrwl/tao, @nrwl/workspace)
  • chore(deps): update nrwl monorepo to v16 (major) (@nrwl/eslint-plugin-nx, @nrwl/tao, @nrwl/workspace)
  • chore(deps): update nrwl/nx-set-shas action to v3
  • chore(deps): update react monorepo to v18 (major) (react, react-dom)
  • fix(deps): update dependency @data-provider/react to v2
  • fix(deps): update dependency @hapi/boom to v10
  • fix(deps): update dependency commander to v10
  • fix(deps): update dependency commander to v11
  • fix(deps): update dependency commander to v9.5.0
  • fix(deps): update dependency cosmiconfig to v8
  • fix(deps): update dependency cross-fetch to v4
  • fix(deps): update dependency express-request-id to v2
  • fix(deps): update dependency express-request-id to v3
  • fix(deps): update dependency fs-extra to v11
  • fix(deps): update dependency inquirer to v9
  • fix(deps): update dependency inquirer-autocomplete-prompt to v2
  • fix(deps): update dependency inquirer-autocomplete-prompt to v3
  • fix(deps): update dependency node-emoji to v2
  • fix(deps): update dependency react-redux to v8
  • fix(deps): update dependency swagger-ui-dist to v5
  • fix(deps): update dependency update-notifier to v6
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/affected-projects.yml
  • actions/checkout v3
  • nrwl/nx-set-shas v2
  • pnpm/action-setup v2.2.2
  • actions/setup-node v3
  • actions/cache v3
.github/workflows/build.yml
  • actions/checkout v3
  • nrwl/nx-set-shas v2
  • pnpm/action-setup v2.2.2
  • actions/setup-node v3
  • actions/cache v3
  • actions/checkout v3
  • pnpm/action-setup v2.2.2
  • actions/setup-node v3
  • actions/cache v3
  • actions/checkout v3
  • pnpm/action-setup v2.2.2
  • actions/setup-node v3
  • actions/cache v3
  • andstor/file-existence-action v1
  • actions/upload-artifact v3
  • codecov/codecov-action v3
  • actions/checkout v3
  • andstor/file-existence-action v1
  • actions/download-artifact v3
  • actions/checkout v3
  • pnpm/action-setup v2.2.2
  • actions/setup-node v3
  • actions/cache v3
  • actions/checkout v3
  • pnpm/action-setup v2.2.2
  • actions/setup-node v2
  • actions/cache v3
  • actions/checkout v3
  • pnpm/action-setup v2.2.2
  • actions/setup-node v2
  • actions/cache v3
.github/workflows/check-affected.yml
  • actions/checkout v3
  • nrwl/nx-set-shas v2
  • pnpm/action-setup v2.2.2
  • actions/setup-node v3
  • actions/cache v3
.github/workflows/publish-to-github.yml
  • actions/checkout v3
  • pnpm/action-setup v2.2.2
  • actions/setup-node v3
  • actions/setup-node v3
.github/workflows/publish-to-npm.yml
  • actions/checkout v3
  • pnpm/action-setup v2.2.2
  • actions/setup-node v3
html
mocks/admin-api-client-data-provider-e2e-vanilla-app/public/index.html
  • axios 0.27.2
npm
mocks/admin-api-client-data-provider-e2e-mocks/package.json
mocks/admin-api-client-data-provider-e2e-react-app/package.json
  • @data-provider/axios 5.0.1
  • @data-provider/core 4.0.0
  • @data-provider/react 1.6.0
  • prop-types 15.8.1
  • react 17.0.2
  • react-dom 17.0.2
  • react-redux 7.2.8
  • redux 4.2.1
mocks/admin-api-client-unit-mocks/package.json
package.json
  • @babel/core 7.22.1
  • @babel/eslint-parser 7.21.8
  • @babel/preset-env 7.22.2
  • @babel/preset-react 7.22.3
  • @babel/preset-typescript 7.21.5
  • @cypress/webpack-preprocessor 5.17.1
  • @nrwl/cli 13.8.3
  • @nrwl/eslint-plugin-nx 13.8.3
  • @nrwl/tao 13.8.3
  • @nrwl/workspace 13.8.3
  • @rollup/plugin-babel 5.3.1
  • @rollup/plugin-commonjs 21.1.0
  • @rollup/plugin-node-resolve 13.3.0
  • @rollup/plugin-typescript 8.5.0
  • @testing-library/cypress 8.0.3
  • @typescript-eslint/eslint-plugin 5.59.7
  • @typescript-eslint/parser 5.59.7
  • babel-jest 27.5.1
  • babel-loader 8.2.5
  • babel-plugin-module-resolver 4.1.0
  • babel-plugin-replace-ts-export-assignment 0.0.2
  • babel-polyfill 6.26.0
  • commander 9.1.0
  • cross-env 7.0.3
  • cross-fetch 3.1.6
  • cross-spawn 7.0.3
  • cypress 9.7.0
  • cypress-fail-fast 3.4.1
  • deepmerge 4.3.1
  • eslint 8.41.0
  • eslint-config-prettier 8.8.0
  • eslint-plugin-jest 26.7.0
  • eslint-plugin-no-only-tests 2.6.0
  • eslint-plugin-prettier 4.2.1
  • fs-extra 10.1.0
  • handlebars 4.7.7
  • husky 7.0.4
  • is-ci 3.0.1
  • is-promise 4.0.0
  • jest 27.5.1
  • lint-staged 12.5.0
  • lodash 4.17.21
  • prettier 2.8.8
  • react 17.0.2
  • react-app-rewired 2.2.1
  • react-scripts 4.0.3
  • request 2.88.2
  • request-promise 4.2.6
  • rollup 2.79.0
  • rollup-plugin-terser 7.0.2
  • serve 13.0.4
  • sinon 13.0.2
  • start-server-and-test 1.14.0
  • tree-kill 1.2.2
  • typescript 4.7.4
  • wait-on 6.0.1
  • webpack 5.84.1
  • node >=14.0.0
packages/admin-api-client-data-provider/package.json
  • @data-provider/axios 5.0.1
  • @data-provider/core 4.0.0
  • redux 4.2.1
  • @data-provider/axios >=3.0.0
  • node >=14.0.0
packages/admin-api-client/package.json
  • cross-fetch 3.1.6
  • node >=14.0.0
packages/admin-api-paths/package.json
  • node >=14.x
packages/cli-runner/package.json
  • cross-spawn 7.0.3
  • tree-kill 1.2.2
  • node >=14.x
packages/config/package.json
  • ajv 8.12.0
  • better-ajv-errors 1.2.0
  • commander 8.3.0
  • cosmiconfig 7.0.1
  • deepmerge 4.3.1
  • fs-extra 10.1.0
  • is-promise 4.0.0
  • lodash 4.17.21
  • node >=14.x
packages/core/package.json
  • @babel/core 7.22.1
  • @babel/register 7.21.0
  • @hapi/boom 9.1.4
  • ajv 8.12.0
  • better-ajv-errors 1.2.0
  • body-parser 1.20.2
  • cors 2.8.5
  • deepmerge 4.3.1
  • express 4.18.2
  • express-request-id 1.4.1
  • fs-extra 10.1.0
  • globule 1.3.4
  • handlebars 4.7.7
  • is-promise 4.0.0
  • lodash 4.17.21
  • node-watch 0.7.3
  • update-notifier 5.1.0
  • winston 3.9.0
  • winston-array-transport 1.1.11
  • yaml 2.3.1
  • node >=14.x
packages/cypress-commands/package.json
  • cypress >=2.0.0
  • node >=14.0.0
packages/inquirer-cli-runner/package.json
packages/logger/package.json
  • winston 3.9.0
  • winston-array-transport 1.1.11
  • node >=14.x
packages/main/package.json
  • deepmerge 4.3.1
  • node >=14.0.0
packages/nested-collections/package.json
  • node >=14.x
packages/plugin-admin-api/package.json
  • @hapi/boom 9.1.4
  • body-parser 1.20.2
  • cors 2.8.5
  • express 4.18.2
  • express-request-id 1.4.1
  • swagger-ui-dist 4.14.0
  • @mocks-server/core >=4.0.0 <5.x
  • node >=14.0.0
packages/plugin-inquirer-cli/package.json
  • inquirer 8.2.4
  • inquirer-autocomplete-prompt 1.4.0
  • lodash 4.17.21
  • node-emoji 1.11.0
  • @mocks-server/core >=4.0.0 <5.x
  • node >=14.0.0
packages/plugin-openapi/package.json
  • json-refs 3.0.15
  • openapi-types 12.1.3
  • @mocks-server/core >=4.0.0 <5.x
  • node >=14.0.0
packages/plugin-proxy/package.json
  • express-http-proxy 1.6.3
  • @mocks-server/core >=4.0.0 <5.x
  • node >=14.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Configuration using environment variables

It is desirable to allow configuration using environment variables.

The approach could be similar to the Cypress one, which accepts environment variables defined in upper snake case, with a project namespace prefix:

MOCKS_SERVER_PORT=4000 npm run mocks-server

It would be great if compatibility with the dotenv-flow package is added too.

Add Plugin Proxy

It is desirable to include Plugin Proxy in main distribution in order to support route variants of type "proxy".

Return always object in plainResponsePreview

Currently the plainResponsePreview of a route variant returns "function" if the response is an express middleware, and an object if it is a static variant. It is desirable to always return the same type. A property type could be added, and it should have function value for the first case, and static for the second one.

Sending Error "request entity too large"

Posting a large JSON payload causes "request entity too large" error and there is no configuration to up this limit.

I believe the default body-parser for the JSON is 100k. There is an option to set a limit but it isn't exposed to the mocks-server user.

Add metrics

It is desirable to add metrics property to the core, providing stats about received requests, sent responses, response times, etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.