this is an API for backend application with the requirements in the requirements document
the API is full covered by integration and unit testing
To get started:
1-clone the repo on the machine
2-install all dependencies by running command
npm install
3-create a .env
file with all the required environment variables:
POSTGRES_HOST="localhost"
POSTGRES_DB="store_backend"
POSTGRES_TEST_DB="store_backend_test"
POSTGRES_USER="postgres"
POSTGRES_PASSWORD="admin"
ENV="test"
BCRYPT_PASSWORD="speak-friend-and-enter"
SALT_ROUNDS="10"
PORT=4000
ACCESS_TOKEN_SECRET="noobs123"
4-Now, check if Postgres has the database database_dev
, if not create it:
# Postgres shell
create database store_backend;
create database store_backend_test;
5-run npm test to test and build the project all tests must success
6-chenge the value of env in .env to be test when you testing and dev when you run the API
7-database is run on localhost port 5432 the project is running on port 4000 to change this please modify the env variables
npm run start
-and then head to your browser at localhost:3000
and it should be working.
npm run test
db-migrate reset --env test
to reset the test data base
npm run build
node dist/index.js
I'm using prettier
npm run prettier
I'm using eslint
npm run lint
npm run test
to test the projectnpm run build
convert typescript to javascript in dist foldernpm run run
build and run the projectnpm lint
run eslintnpm run prettier
- NodeJS - The JavaScript runtime
- npm - The dependency manager
- db-migrate - The database migration tool
- Express - The web framework
- TypeScript - Types JS extension
- Jasmine - The unit testing framework