The libraries need to be installed in order to test the answers for exercise 1 and 3. From the root folder, execute:
$ npm install
You can find the code in the exercise-1-multiply
folder.
To run the tests, from the root folder run:
$ npm run test:multiply
You can find the query and its result in the exercise-2-sql-query
folder.
For this exercise, the code is located in exercise-3-rest-api
.
The API documentation is available here: https://documenter.getpostman.com/view/3136678/SVzz2K4d
To import a Postman collection documenting the API and allowing for quick tests, press this button:
The server uses the database connection string specified in the .env
file.
You can modify it to connect to your own database.
If you have docker installed, you can also simply call:
$ docker-compose up -d
to pull a Postgres image and automatically create two databases (dev/test) with the right name and credentials. Then shut it down with:
$ docker-compose down
To start the development server, run:
$ npm run start
To execute the tests, run:
$ npm run test:api
To build the application and serve it, run:
$ npm run build
$ npm run serve
The API will be available on port 3000 (specified in .env
) with an /api
prefix.