Sign inSign up

gvaldes79/node-api-mongo-businesscard

By gvaldes79

•Updated over 6 years ago

Image
0

891

gvaldes79/node-api-mongo-businesscard repository overview

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

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

This will expose 5 methods

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

Example: POST http://localhost:3010/add-post⁠ body: { "nombre" : "some name", "apellido" : "some lastname", "email" : "email address", "celular" : "cellphone number", "telfijo" : "fixed phone number", "puesto" : "job", "empresa" : "company name" }

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

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

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

Example: GET http://localhost:3010/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:3010/post-update⁠

Example PATCH http://localhost:3000/post-update⁠ body: { "id" : "5e507070bee7a30e84167a03", "nombre" : "updated name", "apellido" : "updated lastname", "email" : "updated email address", "celular" : "updated cellphone number", "telfijo" : "updated fixed phone number", "puesto" : "updated job", "empresa" : "updated company name" }

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:3010/remove-post/{id}⁠

Example DELETE http://localhost:3010/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-businesscard