This application is an API for a small clothing store. The API offers two routes: one for creating vouchers and another for applying these vouchers. The intention of this application is to study tests with JEST.
- REST APIs
- Node.js (Express)
- TypeScript
- Postgres
- PrismaORM
- Joi
- Jest
- Supertest
- Nodemon
POST /vouchers
- Route to create a voucher
- headers: {}
- body: {
"code": "voucher1234",
"discount": 10, (must be between 1 and 100)
}
POST /vouchers/apply
- Route to apply a voucher
- headers: {}
- body: {
"code": "voucher1234",
"amount": 100, (must be greater than 0)
}
This project was started with the Express, so make sure you have the latest stable version of Node.js and npm running locally.
First, clone this repository on your machine:
git clone https://github.com/williameiji/le-voucher.git
Then, inside the folder, run the following command to install the dependencies.
npm install
Finished the process, just start the server
npm run dev
If you want to run the tests
npm run test:unit