Introduction #
This is the core serverless API functionality for Product Entitlements.
Specifically, this API is used by the home-tiles landing page in SpheraCloud and determines whhich products are shown, which are active, and the links for a given users companyId.
This is currently version 1.0.0. No other versions exist at the current time
See detailed design documents for additional details.
Prerequisites #
This code-base is targeted for the Azure Platform and is built on node.js with typescipt and used to target Azure App Functions and the Azure API Management Services.
- Install node.js and typescript in the editor of choice
- If using Microsoft VSCode, install the Azure extensions for API Management and Azure Functions.
- Install testing frameworks Mocha, Chai, and NYC (code coverage).
Configuration #
Create a local.settings.json
file and populate the following key value pairs or create environment variables (process.env.XXX
) with the following:
Field | value | Format | Description |
---|---|---|---|
db_server | server name | string | sql server name |
db_database | database name | string | database name |
db_username | sql user name | string | sql server user name |
db_password | sql password | string | sql server user password |
sb_conn | connection string | string | azure servicebus connection string |
sb_uri | sb url name | string | azure servicebus url |
sb_channel | channel name | string | azure servicebus topic name |
cache_location | cache uri | string | cache url |
cache_port | cache port | string | cache port |
cache_key | cache key | string | cache access key |
cache_expiry | cache expiry | integer | default cache expiration in seconds |
Installing and running code locally #
- Clone code from the devOps repository
- Run the included script “rebuild” defined in package.json. This will add all node_models required by the application.
Running Tests #
All tests are included as part of the code repository under the tests folder. That can be run by executing the included script “test” defined within the package.json file.
The code has coverage in greater than 90% of all code paths. Any changes to the existing code-base should include sufficient tests to maintain a 90% coverage rate.
Deployment #
The service should automatically be built and deployed to a dev environment as part of the defined devOps pipeline (CI/CD). Optionally, the service can be deployed directly from VSCODE or Visual Studio using Azure Extensions.
Versioning #
This service is currently version 1.0.0.
Version | Description | Date | Changed By |
---|---|---|---|
1.0.0 | Initial Version | 2019-10-01 | Jerry Shaughnessy |
1.1.0 | Added User-specific entitlements | 2020-04-17 | Jerry Shaughnessy |
Authors #
- Jerry Shaughnessy - initial work
- Jerry Shaughnessy - user-specific functionality