Skip to content

The aim of this project was to improve my knowledge in framework architecture => template of a minimal typeScript API with account and token authentication

Notifications You must be signed in to change notification settings

YvanDesPatates/ts_api_template

Repository files navigation

Config file

To run the App you need to create a .env file at the root of the project.

Config should follow the example of the .env.example file.

Launch the app with docker compose

Thanks to docker compose you can launch the app directly on the port configured in the .env file with the following command :

sudo docker-compose up

tests

Tests will use their own configuration file, you need to create a .env.test file at the root of the project. Test config should follow the example of the .env.example file.

warning JSON_DATA_BASE_PATH environment variable should be set to run test. Make sure it has not the same value in the .env file and in the .env.test file or your data will be erased when running tests.

To run the tests you can use the following command :

npm run test

It will run tests and generate a coverage report in the coverage folder.

Tests are made with jest and supertest to easily tests the API endpoints and mock DAOs. Mocking DAOs allow us to unit test logic functions and to not push on a database if you have not set up tests database yet. (reminder : you can use tests database thanks to the specific .env.test file)

About

The aim of this project was to improve my knowledge in framework architecture => template of a minimal typeScript API with account and token authentication

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published