to be used with todos-react-FE https://github.com/mihaidld/todos-react-FE for front-end side
- back-end for TODO List app using
express
and middlewares - database
Postgresql
- connexion with
Sequelize
- simple user registration and authentication using API Keys
Public
/register
=> register a user, display generated API Key.
Requiring authentication via API Key
/create
=> create todo/delete/:id
=> delete todo/done/:id
=> change status of a todo to 'done'/undone/:id
=> change status of a todo to 'undone'/list
=> get all todos.
In command line start PostgreSQL database server:
sudo service postgresql start
In PostgreSQL create user db_user
and database db_api_todo
:
postgres=> CREATE ROLE db_user WITH LOGIN PASSWORD 'strongpassword123';
postgres=> ALTER ROLE db_user CREATEDB;
postgres=> CREATE DATABASE db_api_todo;
postgres=> \q
psql -d db_api_todo -U db_user
postgres=> \c db_api_todo;
You are now connected to database "db_api_todo" as user "db_user".
Update local IP
in api-server.js
with your local IP address.
Install dependencies and start express server via terminal command line:
yarn
node src/api-server.js
Create users and tasks using application then check database:
db_api_todo=>SELECT * FROM todos;
db_api_todo=>SELECT * FROM users;