Simple API REST to manage invoices with the purpose of gaining knowledge about CI/CD and serverless applications in Azure.
Just execute:
yarn install
yarn build
yarn start
You can check an Azure Pipeline example about how to generate the artifact here.
It is necessary to set the MONGODB_TOKEN
environment variable with a MongoDB connection string in order to manage the status of the invoices.
Request:
POST /api/
curl -i -H 'Content-Type: application/json' http://localhost:7071/api/ \
-d '{ "invoiceId": "891248192B", "supplier": "Fake supplier", "dateIssued": "2019-10-10 13:30:01 T+0210", "currency": "EUR", "amount": 1000.00, "description": "New projector for confenrece room" }'
Response:
{
"success": true
}
Request:
GET /api/
curl -i -H 'Content-Type: application/json' http://localhost:7071/api/'
Response:
{
"success": true,
"invoices": [<list of invoices>]
}
Request:
GET /api/<invoiceID>
curl -i -H 'Content-Type: application/json' http://localhost:7071/api/<invoiceID>'
Response:
{
"success": true,
"invoices": [<requested invoice>]
}
Request:
DELETE /api/<invoiceID>
curl -X DELETE -i -H 'Content-Type: application/json' http://localhost:7071/api/<invoiceID>'
Response:
{
"success": true
}