Skip to content

mihaidld/todos-express-BE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

todos-express-BE

to be used with todos-react-FE https://github.com/mihaidld/todos-react-FE for front-end side

Features

  • back-end for TODO List app using express and middlewares
  • database Postgresql
  • connexion with Sequelize
  • simple user registration and authentication using API Keys

Routes

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.

Install

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

Usage

Create users and tasks using application then check database:

db_api_todo=>SELECT * FROM todos;
db_api_todo=>SELECT * FROM users;

About

Back-end for TO DO List app

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published