Skip to content

a basic example to create a rest api with nodejs/express and docker

Notifications You must be signed in to change notification settings

brunormferreira/nodejs-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nodejs-docker

run-in-insomnia 100% coverage stars

Table of Contents

Docker

  • On command line, do as follow:
$ sudo docker build # > rebuild image
$ sudo docker-compose up # > up container
  • Or run only
$ docker-compose up --build

Packages

  • uuidv4;
  • nodemon;
  • express;
  • cors;

HTTP methods

  • GET
  • POST
  • PUT
  • DELETE

API Reference

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.

About

a basic example to create a rest api with nodejs/express and docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published