This application is generated using ARC CLI, serves as the Notification Microservice for the Telemedicine Application.
By default, dependencies were installed when this application was generated.
Whenever dependencies in package.json
are changed, run the following command:
npm install
To only install resolved dependencies in package-lock.json
:
npm ci
npm start
You can also run node .
to skip the build step.
Open http://127.0.0.1:3000 in your browser.
To deploy this service on AWS lambda, refer the following steps, ensure that you're in the notification-service
directory:
- Run
npm run build
to generate the code build - Run
npm run build:layers
to generate the node_modules as lambda layers - Run
npm run build:migrations
to install dependencies as layers for database migration code which will be deployed as a separate lambda function. - We can choose to skip running commands mentioned in step 1-3 and directly run
npm run build:all
to build the lambda layers, code build and migrations for the service - Step into cdk folder inside the service and run
npm i
then update the.env
file (make sure upstream dependencies like PostgreSQL DB are already setup and the database is created). - Run
npx cdktf deploy migration
to deploy the migration lambda on AWS using terraform constructs. - Run
npx cdktf deploy lambda
to deploy the service lambda on AWS using terraform constructs.
For more information on the steps and environment variable needed for CDK to run check this.
This service picks up environment variables from AWS Secrets Manager, To run the service successfully, you need to set up the following environment variables the in secrets manager with the secret named telemed-app-service-notification
, or you can customize this name by modifying config.ts
inside src
folder.
Environment Variable | Description |
---|---|
DB_HOST | The hostname of the database. |
DB_USER | The username of the database. |
DB_PASSWORD | The password of the database. |
DB_DATABASE | The name of the notificatoin database. |
DB_SCHEMA | The schema of the postgres database to use. |
JWT_SECRET | JWT Secret to validate signed bearer tokens. |
JWT_ISSUER | The issuer for the JWT token. |
PUBNUB_SUBSCRIBE_KEY | The subscribe key of PubNub. |
PUBNUB_PUBLISH_KEY | The publish key from PubNub. |
PUBNUB_SECRET_KEY | The secret key of PubNub credentials. |
To incrementally build the project:
npm run build
To force a full build by cleaning up cached artifacts:
npm run rebuild
npm run lint
To automatically fix such issues:
npm run lint:fix
npm run migrate
: Migrate database schemas for modelsnpm run openapi-spec
: Generate OpenAPI spec into a filenpm run docker:build
: Build a Docker image for this applicationnpm run docker:run
: Run this application inside a Docker container
npm test
Please check out LoopBack 4 documentation to understand how you can continue to add features to this application.