Back-end for M-Cubed app
- Fork and Clone this repository
- Create a .env with:
PORT=<server port>PG_HOST=<database url>PG_PORT=5432PG_DATABASE=m3_devPG_USER=postgresPG_PASSWORD=<database password - if necessary>SECRET=<password>
- Install project dependencies with
npm install
npm run start: to run the servernpm run watch: to run the server using nodemonnpm run db:init: to initialize the databasenpm run db:seed: to seed the databasenpm run dev: to initialize and seed the databa
| # | Protected | URL | HTTP Method | Description |
|---|---|---|---|---|
| 00 | ❌ | / |
GET | API “home” route |
| 01 | ❌ | /login |
POST | Log In User |
| 02 | ❌ | /borrowers/ |
POST | Create a new Borrower |
| 03 | ✅ | /borrowers/:id/ |
GET | Get Borrower |
| 04 | ✅ | /borrowers/:id/ |
PUT | Update Borrower |
| 05 | ✅ | /borrowers/:id/ |
DELETE | Delete Borrower |
| 06 | ✅ | /borrowers/:id/requests/ |
GET | Get all loan requests made by the Borrower |
| 07 | ✅ | /borrowers/:id/requests/ |
POST | Create a new loan request |
| 08 | ✅ | /borrowers/:b_id/request/:id/ |
GET | Get single loan request for a given borrower |
| 09 | ✅ | /borrowers/:b_id/request/:id/ |
PUT | Update loan request |
| 10 | ✅ | /borrowers/:b_id/request/:id/ |
DELETE | Delete loan request |
| 11 | ✅ | /borrowers/:b_id/request/:id/proposals/ |
GET | Get all proposals for a single loan request |
| 12 | ✅ | /borrowers/:b_id/request/:id/proposals/ |
PUT | Accept given proposition, and reject all others |
| 13 | ✅ | /borrowers/:b_id/request/:r_id/proposals/:id |
GET | Get a single proposition for a given loan |
| 14 | ❌ | /lenders/ |
POST | Create a new Lenders |
| 15 | ✅ | /lenders/:id/ |
GET | Get a Single Lender |
| 16 | ✅ | /lenders/:id/ |
PUT | Update Lender |
| 17 | ✅ | /lenders/:id/ |
DELETE | Delete Lender |
| 18 | ✅ | /lenders/:id/proposals/ |
GET | Get all proposals made by the lender |
| 19 | ✅ | /lenders/:l_id/proposals/:id/ |
GET | Get a single made by the Lender |
| 20 | ✅ | /lenders/:l_id/proposals/:id/ |
PUT | Update loan proposition |
| 21 | ✅ | /lenders/:l_id/proposals/:id/ |
DELETE | Update loan proposition |
| 22 | ✅ | /lenders/:l_id/requests/ |
GET | Get all pending requests (not accepted) |
| 23 | ✅ | /lenders/:l_id/requests/:id/ |
GET | Get a single loan request |
| 24 | ✅ | /lenders/:l_id/requests/:id/ |
POST | Create a new Proposition |
| 25 | ❌ | /mail-list |
GET | Get all email |
| 26 | ❌ | /mail-list |
POST | Create a new entry |
| 27 | ❌ | /mail-list/:id |
POST | Delete an entry |
You check the endpoints here