@haulmont/jmix-server-mock
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Usage

Command Line

npx @haulmont/jmix-server-mock

By default, it will use schema.graphql and start server at port 4000 http://localhost:4000/graphql

Customize schema path and port using corresponding options

npx @haulmont/jmix-server-mock --schema path/to/schema.graphql --port 8081

From Code

require('@haulmont/jmix-server-mock').createServer(schemaPath)
    .then(({expressApp, apolloServer}) => {
      expressApp.listen({port});
      console.log(`Server ready at http://localhost:${port}${apolloServer.graphqlPath}`);
    })

Usage in Jmix Frontend

Make sure @haulmont/react-scripts is used

  "devDependencies": {
    ...
    "@haulmont/react-scripts": "^4.0.2-alpha.7",
    ...
  }

Specify the following env variable

JMIX_SERVER_MOCK_GRAPHQL=path/to/schema.graphql

The mock server endpoints are available at the same port as dev server (e.g. http://localhost:3000/oauth/token)

proxy configuration won't work once mock server is enabled

Readme

Keywords

none

Package Sidebar

Install

npm i @haulmont/jmix-server-mock

Weekly Downloads

1

Version

1.0.4

License

Apache-2.0

Unpacked Size

26.6 kB

Total Files

17

Last publish

Collaborators

  • cuba-platform