Checkout the OpenAPI spec here
Install deps with npm
npm install
npx husky install
Clone the project
git clone https://link-to-project
Go to the project directory
cd my-project
Install dependencies
npm install
Start the server
npm run start
To run tests, run the following command
npm run test
To only run unit tests:
npm run test:unit
To only run integration tests:
npm run test:integration
Caution
set database connection properties in test.json and local.json for a non-existing database or else you might cause damage to your database when running tests
Building the migrations docker file
docker build -t pp-migration:v<tag> -f migrations.Dockerfile .
Running the migration docker locally
docker run -it --rm -e NODE_ENV=<env> --network host -v ./config/<env>.json:/usr/app/config/<env>.json pp-migration:<tag>
Note: in this command we are mounting local config file to the container instead of adding -e to all environment variables .
In the following example a production.json file is provided. The <env>
is set to production. like so:
docker run -it --rm -e NODE_ENV=production --network host -v /path/to/production.json:/usr/app/config/production.json pp-migration:v1.0.1
production.json:
{
"db": {
"type": "postgres",
"host": "localhost",
"port": 5432,
"username": "postgres",
"password": "password",
"enableSslAuth": false //Note: when ssl is enabled , ssl keys could be mounted the same way as config
"sslPaths": { //Note: this should hold the paths to the keys inside the mounted folder
"ca": "",
"key": "",
"cert": ""
},
"database": "test_migrations",
"schema": "polygon_parts",
"synchronize": false,
"logging": "all", //available values: false , true, "all"
"entities": ["**/DAL/*.js"],
"migrations": ["db/migrations/*.js"],
"applicationName": "polygon_parts"
}
}