https://github.com/edwardcdev/node-express-rest-api
A simple REST API based on Node.js, Express.js and SQLite
https://github.com/edwardcdev/node-express-rest-api
express node restful-api sqlite
Last synced: about 1 month ago
JSON representation
A simple REST API based on Node.js, Express.js and SQLite
- Host: GitHub
- URL: https://github.com/edwardcdev/node-express-rest-api
- Owner: edwardcdev
- Created: 2021-10-15T12:47:04.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-15T13:06:09.000Z (over 3 years ago)
- Last Synced: 2025-01-29T11:52:18.248Z (3 months ago)
- Topics: express, node, restful-api, sqlite
- Language: JavaScript
- Homepage:
- Size: 81.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node Express REST API
## Running
1. `npm install`
1. `npm run seed`, to create a database in `database.sqlite3`.
1. `npm start`.
## Specification
- Server : [nodemon](https://nodemon.io/)
- Database : SQLite
- ORM : [Sequelize](http://docs.sequelizejs.com/)
- Middleware: `getProfile`
## Data Models
### Profile
A profile can be either a `client` or a `contractor`.
clients create contracts with contractors. contractor does jobs for clients and get paid.
Each profile has a balance property.### Contract
A contract between and client and a contractor.
Contracts have 3 statuses, `new`, `in_progress`, `terminated`. contracts are considered active only when in status `in_progress`
Contracts group jobs within them.### Job
contractor get paid for jobs by clients under a certain contract.## APIs
1. ***GET*** `/contracts/:id`
1. ***GET*** `/contracts`
1. ***GET*** `/jobs/unpaid`
1. ***POST*** `/jobs/:job_id/pay`
1. ***POST*** `/balances/deposit/:userId`
1. ***GET*** `/admin/best-profession?start=&end=`
1. ***GET*** `/admin/best-clients?start=&end=&limit=`