- Git - Download & Install Git.
- Node.js - Download & Install Node.js and the npm package manager.
- Install Docker
- Run docker desktop application, if you use windows or run docker engine if you use other system
git clone {repository URL}
go to the copied folder, in your terminal and complete next command:
cd nodejs2023Q2-service
git checkout HLS-3
npm install
-
Create .env file (based on .env.example) in copied folder: ./.env
- logging level stored in
LOG_LEVELS
environment variable (Note: valid logging level 0 <= n <= 4, default:4
) - Max file size stored in
MAX_FILE_SIZE
environment variable, the value is specified inkB
, default:48
- logging level stored in
-
Run next command in your terminal, for building images and docker containers up:
docker-compose up -d
- App logs are written in the
./logs:/usr/app/logs
volume (./logs
dir in app root)
After docker compose command complete and dockers starting you can open in your browser OpenAPI documentation by typing http://localhost:4000/doc/ (port 4000 as default) and execute test queries.
After application running in dockers open new terminal in your host machine and enter:
To run all tests with authorization
npm run test:auth
To run only one of all test suites
npm run test:auth -- <path to suite>
npm run docker:scan
Migrations execute automatically when docker-compose
command complete and create database entities.
If you want to migrate manually you can execute next command in your terminal:
rm -rf ./prisma/migrations
npx prisma migrate dev --name my-custom-migrate
npm run lint
npm run format
-
link for server: http://localhost:4000/doc
-
All endpoints (except
auth/signup
,auth/login
,/doc
and/
) are protected with JWT authentication. You should provide JWT token inAuthorization: Bearer <jwt_token>
request header, but forauth/refresh
route you should provide JWT refresh token in request body:
{refreshToken: 'your_token'}
- Sign Up via
auth/signup
. (Note: Login is unique field in db, and you can create only one user with such login.) - Login with your
login
andpassword
and get tokens viaauth/login
- Press
Authorize
button and use youraccessToken
Press F5 to debug.
For more information, visit: https://code.visualstudio.com/docs/editor/debugging