Sample barebone application using Express.js, node-postgres, dotenv, ajv, ajv-format, fast-json-patch and using PostgresSQL as persistence.
This application deals with 2 entities employees and their associated departments.
Sample structure of departments table -
| id | name | created_at | update_at |
|---|---|---|---|
| 1 | Human Resources | 2021-07-26 18:33:32.48293 | null |
Sample structure of employees table -
| id | name | code | salary | hire_date | manager_id | dept_id | created_at | update_at |
|---|---|---|---|---|---|---|---|---|
| 10 | Marsha Heers | EM0010 | 61192.38 | 2011-03-31 | 3 | 3 | 2021-07-26 18:33:45.171566 | null |
Restful endpoints allow for -
- Paging
/api/employees?page=1&limit=10 - Get single by id
/api/employees/10 - Creating
/api/employees - Updating
/api/employees/7 - Deleting
/api/employees/7 - Patching
/api/employees/7
- To run -
npm install - To start the server -
npm start - Seed script
hereto get up and running quickly. - Postman
collectionandenvironment variableshere.