-
A basic example to create an api with Nodejs and containering with Docker.
-
Tests API Calls with Insomnia REST Client.
-
Pizza API. :P
- On command line, do as follow:
$ sudo docker build # > rebuild image
$ sudo docker-compose up # > up container
- Or run only
$ docker-compose up --build
- uuidv4;
- nodemon;
- express;
- cors;
- GET
- POST
- PUT
- DELETE
All requests require a key parameter, eg /api/
Endpoint | Method |
---|---|
/api/pizzas | GET |
Sample Response
[
{ "name": "Basca", "flavor": "meat and vegetables", "price": 50.40 },
{ "name": "Pepperoni", "flavor": "Pepperoni and herbs", "price": 44.70 }
]
Endpoint | Method |
---|---|
/api/pizzas | POST |
Sample Response
{
"id": "01dac858-cf38-4b8a-885d-ad2af6c03653",
"name": "Pepperoni",
"flavor": "Pepperoni and herbs",
"price": 44.80
}
Endpoint | Method |
---|---|
/api/pizzas/:id | PUT |
Sample Response
{
"id": "01dac858-cf38-4b8a-885d-ad2af6c03653",
"name": "Chesse",
"flavor": "Cheese and Pepperoni",
"price": 51.20
}
Endpoint | Method |
---|---|
/api/pizzas/:id | DELETE |
No Response
Only status 204.