- About
- How to install and use
- Application operate with the following resources
- Details
- Logging
- Developer environment and instruments
REST service application which used PostgreSQL database with TypeORM library, built on NestJS framework and containerized by Docker
Technical task
- REST service
- Typescript basics
- Logging & Error Handling
- Docker basics
- PostgreSQL & Typeorm
- Authentication and JWT
- NestJS
- Using Docker Compose
- Install Docker and Docker Compose
- Clone this repository
- Switch to task_10_nestjs branch
- Command string for start PostgreSQL DB in Docker:
docker-compose up
- Run
npm i
to install dependencies - Run
npm run start:dev
to start REST-service app - Command string for tests (start app in docker image first):
npm run test:auth
- Application starts on port 4000 by default
- After starting the app you can open in your browser OpenAPI documentation by typing
http://localhost:4000/doc/
User
(with attributes):{ id, name, login, password }
Board
(set ofcolumns
):{ id, title, columns }
Column
(set of tasks):{ id, title, order }
Task
:{ id, title, order, description, userId, //assignee boardId, columnId }
-
For
User
,Board
andTask
REST endpoints with separate router paths should be createdUser
(/users
route)GET /users
- get all users (remove password from response)GET /users/:userId
- get the user by id (ex. “/users/123”) (remove password from response)POST /users
- create userPUT /users/:userId
- update userDELETE /users/:userId
- delete user
Board
(/boards
route)GET /boards
- get all boardsGET /boards/:boardId
- get the board by idPOST /boards
- create boardPUT /boards/:boardId
- update boardDELETE /boards/:boardId
- delete board
Task
(boards/:boardId/tasks
route)GET boards/:boardId/tasks
- get all tasksGET boards/:boardId/tasks/:taskId
- get the task by idPOST boards/:boardId/tasks
- create taskPUT boards/:boardId/tasks/:taskId
- update taskDELETE boards/:boardId/tasks/:taskId
- delete task
-
When somebody
DELETEs
Board
, all itsTasks
should be deleted as well. -
When somebody
DELETEs
User
, allTasks
whereUser
is assignee should be updated to putuserId = null
.
The App implements a Logging service. Logging supports multiple logging levels and store logging level in environment variable.
Three levels of logging are supported:
error
warn
info
To define max logging level set variable LOGGING_LEVEL
in the .env
file.
- Events with defined in
.env
logging level are logging toConsole
and file./logs/common.log
- Events with level error are logging to the file
./logs/error.log
too uncaughtException
andunhandledRejection
events are logging with levelerror
- Node 16.13.0
- JWT Authorization
- TypeScript 4.5.2
- NestJS - server-side node.js framework
- PostgreSQL DB
- TypeORM
- Docker
- Jest 27.3.1
- Supertest 6.1.6
- ESLint 8.3.0
- TSDoc 0.0.4
- Npm 8.1.0