Basic understanding on JavaScript, NodeJS and Postgres.
cd <Project Dir>
npm install
npm run generate-config
// Run containers
docker-compose up
// Clean containers
docker-compose down
npm run docker:build
npm run docker:start
This will run both postgres and app container. You can use postman client to access API on localhost:3000.
On startup it will create the required tables and insert default data like default roles and users.
You can clean the containers by using following commands.
npm run docker:clean
Login User
POST /api/auth/login
{
email: <user-email>,
password: <user-password>
}
Logout User
POST /api/auth/logout
List all the users
GET /api/users
List single user
GET /api/users/:id
Create user
POST /api/users
{
email: <string>,
firstname: <string>,
lastname: <string>,
password: <string>,
roles: Array<string>
}
Delete user
DELETE /api/users/:id
List all the roles
GET /api/roles
List single role
GET /api/roles/:id
Create role
POST /api/roles
{
name: <string>,
priviledges: Array<string>,
description: <string>
}
Delete role
DELETE /api/roles/:id