Clients
Once you’ve deployed your service, you can connect any number of client NPM projects to it.
Client Module
Connecting a client to a service involves generating client code called a Client Module.
The client module contains:
- The classes and functions your client code can use to access the service.
- A user key used to authenticate the client code to the Roli platform at runtime.
- The version number of the deployed service.
- The URL of the Roli platform installation.
Generating a client module
To create a client module for your service, use the generate-client
command:
The client module will be generated in the .roli/bindings/<service-name>
directory. It is automatically set as a dependency in the client project’s package.json.
Supressing build integration
Optionally, you can generate the client module without requiring a dependency installation:
Importing the client module
The client module is unique to the service and will be named <service-name>-service
. The client module can be imported just like any other NPM module dependency.