TODO app - server API
Start
Linux:
- install Postgresql:
sudo apt install postgresql
- switch to a postgres user:
sudo -iu postgres
(orsu postgres
under the root) - connect to the CMD:
psql
- create a new database:
CREATE DATABASE todo_db;
- connect to this db:
\c todo_db;
- initialize db data following
src/db/init.sql
(skip CREATE DATABASE instruction) - exit from CMD
- copy
.env.example
content to.env
and fill missing values (change default values if necessary) - start the server:
npm run start
Routes
- POST
users/login
: user login. Only admin available - POST
users/auth
: authentitication - GET
tasks/all
: return an array of all tasks (sorted by tasks id) - GET
tasks/:id
: return a task with:id
- POST
tasks/new
: create a new task - PATCH
tasks/:id
: update a task with:id
- DELETE
tasks/:id
: delete a task with:id
TODO
- improve response formats
- save users session, so the user don't need to login every time
- correct EMAIL regexp to block emails with length more than 255 chars