https://github.com/karmek-k/nodejs-api-assignment
https://github.com/karmek-k/nodejs-api-assignment
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/karmek-k/nodejs-api-assignment
- Owner: karmek-k
- License: agpl-3.0
- Created: 2022-11-07T17:39:45.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-11-22T16:34:07.000Z (over 2 years ago)
- Last Synced: 2025-01-11T01:50:57.883Z (5 months ago)
- Language: TypeScript
- Size: 156 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Node.js API assignment
Recruitment assignment for Coffee Mug
## Runtime dependencies
As few as possible.
- Express
- Inversify, `inversify-express-utils` and `reflect-metadata`
- SQLite (without an ORM)I wrote validation and database handling logic by myself.
## Installation
Install dependencies using Yarn
```yarn```
Build TypeScript files
```yarn build```
Create and migrate the database
```yarn install-db```
Run the API!
```yarn start```
## Routes
*Price is an integer in order to prevent rounding errors.*
- `GET /products` - List all products
- `GET /products/1` - Retrieve one product by its ID
- `POST /products` - Create a new productExample payload:
```json
{
"name": "keyboard",
"price": 1000
}
```- `PUT /products` - Update an existing product
Example payload:
```json
{
"id": 1,
"name": "mouse",
"price": 800
}
```- `DELETE /products/1` - Delete a product