comp-intel-monitoring-api
v1.0.1
Published
API supporting the Norstella Competitive Intelligence Monitoring Dashboards.
Downloads
4
Readme
CompIntel Monitoring API
API supporting the Norstella Competitive Intelligence Monitoring Dashboards.
Installation
Install NVM for managing node.js versions
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
Use the node version which is auto selected from the repo config
nvm use
Install dependencies
npm install
Install Podman (free docker alternative) for running the database
Install to your OS
podman machine init
podman machine start
Local development
Local development can be done my running the application locally with serverless-offline
npm run start
This will spin up a local web server on port 5002 which emulates the API Gateway and Lambda integration that would be deployed into AWS. This local API can be tested directly using a tool like curl or PostMan. It also can be used as the API for the CompIntel UI running locally by setting the environment of the UI to localOffline
Database Queries
This application uses an Aurora Postgres RDS instance as the App DB.
Locally this is emulated in both the tests and serverless offline using an container running locally. The schema is read from the SQL DDL found in the scripts folder on startup.
Run the following command to set up a fully populated db locally for testing:
npm run db
This application uses the Kysely SQL Query Builder to build and execute fully Type Safe database queries. The TypeScript types are generated automatically from the SQL DDL found in the scripts folder.
DB Type Generation
The DDL in the scripts folder is currently generated from the Dev RDS instance and can be updated using the DB GUI of your choice.
When the schema is updated the TypeScript types can be generated using the type generator. This is dependent on a locally running Postgres DB instance. This can be done using the podman container runner.
With podman installed you can run the following:
npm run db:generate
Then the types will be updated in the db/generated folder.