CLI
note
  Prerequisites: Install npx if you don't have it installed yet: npm i -g npx
| Command | Description | 
|---|---|
npx subscriptions list | lists project subscriptions | 
npx subscriptions start | starts project subscriptions | 
tip
  Alternatively the CLI can be found at ./node_modules/.bin/subscriptions
CLI Options#
Subscriptions List#
This will output a table of all subscriptions and their descriptions. Example output:
Subscriptions Start#
This will start a subscription service using the subscription.service.{js/ts} file in your PUBSUB_ROOT_DIR. It will first call the init method of the Service class and then start the subscriptions, allowing you to do any startup tasks. Read more about service here
Development Environment#
For local use you may want to call the CLI with ts-node instead of directly if you are using typescript.
Usage with Typescript#
For use with Typescript, update your local PUBSUB_ROOT_DIR env var to the src directory of the project with the typescript files.
And instead of using npx subscriptions start you can invoke the bin script with ts-node:
If you have a separate tsconfig for your server code then you should pass it to ts-node:
To make this easier you can add a script in your package.json:
Use Debugger with Typescript#
ts-node doesn't have an --inspect option unlike the node cli. But we can still pass it to the node process by way of the NODE_OPTIONS env var.
Watch Mode with Typescript#
You can use nodemon in combination with ts-node to develop in watch mode: