Let's try to create a competitor for Trello!
NB! You must create new repository from template for this task. Its name must be nodejs2021Q4-service
i.e. full link to the repository must be https://github.com/%your-gihub-id%/nodejs2021Q4-service
.
Create an application, the application should operate with the following resources:
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 }
Details:
-
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
. -
For now, these endpoints should operate only with in-memory (hardcoded) data, in the next tasks we will use a DB for it. You may organize your modules with the consideration that the data source will be changed soon.
-
An
application/json
format should be used for request and response body. -
Do not put everything in one file - use a separate file for application creation (bootstrapping), for controllers (routers) and code related to business logic. Also split files to different modules depends on a domain (user-related, board-related, etc...).
-
To run the service
npm start
command should be used. -
Service should listen on PORT
4000
. -
You can try to refactor template using framework that differs from Express.js and Nest.js
Hints
- To generate all entities
id
s use uuid package or Node.js analogue.