Back-end Development Project for Driven Bootcamp course
Browse TypeScript code»
This Api can be used in two different ways: by cloning the project or by running in your preferred client, such as Insomnia or Postman.
To clone the project, run the following command:
git clone https://github.com/MileneGJ/projeto18-valex.git
Then, navigate to the project folder and run the following command:
npm install
Finally, start the server:
npm start
You can now access the API's endpoints by navigating to http://localhost:5000/
This project used as reference a postgres database that can be created using these scripts
Since this application is not deployed, it is recommended to create a local database with the scripts above for the correct functioning of the project resources.
In this section, you will find the API's endpoints and their descriptions, along with the request and response examples. All data is sent and received as JSON.
Cards /card
Payments /purchase
Recharges /recharge
{
"employeeId": "1",
"cardType": "health"
}{
"Content-Type": "application/json",
"x-api-key": "placeholder-api-key"
}| Status Code | Description | Properties |
|---|---|---|
| 201 | Created | data: {} |
| 401 | Unauthorized | error: { message } |
| 404 | Not Found | error: { message } |
| 409 | Conflict | error: { message } |
| 422 | Invalid Input | error: { message } |
| 500 | Internal Server Error | error: { message } |
{
"securityCode": "616",
"password": "1234"
}{
"Content-Type": "application/json"
}cardId:3
| Status Code | Description | Properties |
|---|---|---|
| 200 | OK | data: {} |
| 401 | Unauthorized | error: { message } |
| 404 | Not Found | error: { message } |
| 409 | Conflict | error: { message } |
| 422 | Invalid Input | error: { message } |
| 500 | Internal Server Error | error: { message } |
cardId:3
| Status Code | Description | Properties |
|---|---|---|
| 200 | OK | data: {} |
| 404 | Not Found | error: { message } |
| 409 | Conflict | error: { message } |
| 422 | Invalid Input | error: { message } |
| 500 | Internal Server Error | error: { message } |
{
"password": "1234"
}{
"Content-Type": "application/json"
}cardId:3
| Status Code | Description | Properties |
|---|---|---|
| 200 | OK | data: {} |
| 401 | Unauthorized | error: { message } |
| 404 | Not Found | error: { message } |
| 409 | Conflict | error: { message } |
| 422 | Invalid Input | error: { message } |
| 500 | Internal Server Error | error: { message } |
{
"password": "1234"
}{
"Content-Type": "application/json"
}cardId:3
| Status Code | Description | Properties |
|---|---|---|
| 200 | OK | data: {} |
| 401 | Unauthorized | error: { message } |
| 404 | Not Found | error: { message } |
| 409 | Conflict | error: { message } |
| 422 | Invalid Input | error: { message } |
| 500 | Internal Server Error | error: { message } |
{
"password": "1234"
"cardId": 3,
"amount": 1000
}{
"Content-Type": "application/json"
}businessId:5
| Status Code | Description | Properties |
|---|---|---|
| 201 | Created | data: {} |
| 401 | Unauthorized | error: { message } |
| 404 | Not Found | error: { message } |
| 409 | Conflict | error: { message } |
| 422 | Invalid Input | error: { message } |
| 500 | Internal Server Error | error: { message } |
{
"cardNumber": "1234-1234-1234-1234"
"cardholderName": "JOHN S SMITH",
"expirationDate": "09/27",
"securityCode": "277",
"amount": 1000
}{
"Content-Type": "application/json"
}businessId:5
| Status Code | Description | Properties |
|---|---|---|
| 201 | Created | data: {} |
| 401 | Unauthorized | error: { message } |
| 404 | Not Found | error: { message } |
| 409 | Conflict | error: { message } |
| 422 | Invalid Input | error: { message } |
| 500 | Internal Server Error | error: { message } |
{
"amount": 1000
}{
"Content-Type": "application/json",
"x-api-key": "placeholder-api-key"
}businessId:5
| Status Code | Description | Properties |
|---|---|---|
| 201 | Created | data: {} |
| 401 | Unauthorized | error: { message } |
| 404 | Not Found | error: { message } |
| 409 | Conflict | error: { message } |
| 422 | Invalid Input | error: { message } |
| 500 | Internal Server Error | error: { message } |