This project is the back-end part of an assessment. It is a todo list project. The front-end part repository is here: front-end
http://ec2-13-56-11-106.us-west-1.compute.amazonaws.com:8080/
The server side is designed in MVC pattern.
Static file service path is public/
, and all the APIs are supported in socket.
The websocket is in routes/ws.ts
The routes are in routes/routers.ts
.
The data model is in model/Todo.ts
.
The main business logics are in controller/todoController.ts
.
In the websocket part, if there is any update of the list by a client, server will send boardcast message to all of the clients in order to update the data. More details are here.
This project uses Koa2, PostgreSQL and Socket.io. Please install the dependencies first.
$ npm install
or
$ yarn
Use below command to launch the project. It will listen 8080 port by default(both the http and websocket are in the same port). You can change the port in src/server.js
.
$ npm start
or
$ yarn start
Use the command below. Because it is an exercise project. The test is also connected to the onnline database.
npm test
or
yarn test
- Use the command below, and the compiled files are in the
build/
folder.
$ npm build
or
$ yarn build
-
Copy the font-end compiled files into the
build/public
folder. -
Run the
index.js
in the server.
$ yarn && node index.js