Sign inSign up

gvaldes79/node-api-mongo

By gvaldes79

•Updated over 6 years ago

Image
0

901

gvaldes79/node-api-mongo repository overview

This docker is ment as an API for using a mongoDB as persistence back-end It is an example of using mongo to persist some data You should run it including -e MONGODB environmental variable

Example: docker run --name apimongo -p 3000:3000 -e MONGODB="mongodb+srv://yourDatabase?retryWrites=true" gvaldes79/node-api-mongo

This will expose 5 methods

A POST method for adding a new element endpoint: http://localhost:3000/add-post⁠

Example: POST http://localhost:3000/add-post⁠ body: { "title" : "some title", "description" : "some description", "image" : "url to some image" }

A GET method for listing entire collection endpoint: http://localhost:3000/posts⁠

Example: GET http://localhost:3000/posts⁠

A GET method for listing an object endpoint http://localhost:3000/posts/{id}⁠

Example: GET http://localhost:3000/posts/5e507070bee7a30e84167a03⁠

this example asumes 5e507070bee7a30e84167a03 is the id of the record you want to get

A PATCH method for updating an entry by ID endpoint http://localhost:3000/post-update⁠

Example PATCH http://localhost:3000/post-update⁠ body: { "id" : "5e507070bee7a30e84167a03", "title" : "update title", "description" : "update description", "image" : "update url" }

this example asumes 5e507070bee7a30e84167a03 is the id of the record you want to update

And a DELETE method to erase an entry endpoint http://localhost:3000/remove-post/{id}⁠

Example DELETE http://localhost:3000/remove-post/5e506dc3bee7a30e84167a02⁠

this example asumes 5e506dc3bee7a30e84167a02 is the id of the record you want to delete

Tag summary

Content type

Image

Digest

Size

28.7 MB

Last updated

over 6 years ago

docker pull gvaldes79/node-api-mongo