This is a RESTful API that uses:
- Node.js
- Typescript.js
- Express.js
- Postgresql
- Prisma
- express-validator
- TypeDI
- Docker & Docker compose
npm install
Prerequisites: have Docker running
npm run start
This command will:
- Run the postgres instance using docker-compose, port
5432
- Build the project
- Run the project on port
3000
- Insert seed data
You can import from Postman the Sprocket API.postman_collection.json
file or create your own requests.
Lists factories paginated using offset
and limit
.
GET /factory?offset=:offset&limit=:limit`
Returns the factory by id
GET /factory/:id
Returns factory performance values between fromDate
and toDate
. If no values are passed, default values are assigned.
GET /factory/:id/performance-values?fromDate=:fromDate&toDate=:toDate
Returns the sprocket by id
.
GET /sprocket/:id
Returns the sprocket by id
. All fields are required.
POST /sprocket
{
"teeth": 1,
"pitchDiameter": 2,
"outsideDiameter": 3,
"pitch": 4
}
Updates the sprocket by id
. All fields are optional.
PUT /sprocket/:id
{
"teeth": 1,
"pitchDiameter": 2,
"outsideDiameter": 3,
"pitch": 4
}
- Implement authentication endpoint using JWT
- Authenticate all endpoints
- Improve data validation
- Implement pagination for sprockets
- Implement testing: unit, integration, E2E, load
- Use Swagger to document the API
- Create two more envs: stg, prod. Create terraform scripts to deploy using Kubernetes
- Implement CI/CD pipeline, add github actions or use Buildkite to validate PRs and deploy
- Consider using a cache like Redis to cache data, i.e. factory data