Postman with NodeJS and MongoDB

Postman with NodeJS and MongoDB

Hello people of Hive, in this case, I will show how we add data with the functions we made in the last post, here we use our database and the express server with node to connect and we use Postman a great tool to test backend code. You can download the Desktop App easily and execute

postman1.png

First, we will see here the stuff we need to install using npm we install express, mongoose 6.10 in this case, and body-parser, and then we can node server.js to start our server we can also see in mongolink we use the link that our mongo cluster shows to us and the password from the user, we can go explore on mongo or check the other posts to see this.

postman2.png

We made 2 functions in the past post, and now we will use them to add data to the database, if we remember we made an add function for the user or client, here we just add localhost the port we using in this case and we add the router we made the last post, here we just send the data from body params and we select URL-encoded, we use the key value

postman3.png

Here I will check in the Datababase Collections and we can see the client we just added is working well, we also have the id that mongo creates by default. We can see the Data is JSON, this is the advantage of using MongoDB, the data is stored in JSON and we can access it in the same way, which is helpful for integration.

postman4.png

Finally, we will add data to the product collection with the function in the router /create, we just send the value in needs and we also can see in Postman the Status 200 OK, and the JSON in the bottom, that's the same data that we are saving in the MongoDB Database.

postman5.png

Thank you very much to all for your attention, we can now see the JSON collections in mongoDB we also started an easy server with 2 functions that help to add data with Postman, I hope you find this information useful for your programming.

You can check my blog here: https://peakd.com/@taradraz1

Also if you have questions you can leave them in the comments and I can answer them so we can keep getting better, remember to check the last post and make sure you install all it needs to work!!!



0
0
0.000
5 comments
avatar

Congratulations @taradraz1! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You received more than 8000 upvotes.
Your next target is to reach 9000 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out our last posts:

LEO Power Up Day - December 15, 2023
0
0
0.000
avatar

Postman is a very interesting tool to test your api, I really enjoy it, there are some other alternatives but I didn't test it yet.


Want to Know more about Hivepakistan?

Ping Us On Hive Pakistan Discord server

To support HivePakistan, delegate Hive Power to hivepakistan and earn 90% curation reward :)

Here are some handy links for delegation


| 50 HP | 100 HP |500 HP | 1000 HP | 5000 HP | 10000 HP | 20000 HP |

A delegation of 500 or more HP makes you earn Hivepakistan supporter badge.

0
0
0.000
avatar

Thanks!! yes, it's a great tool i am using it a lot right now!!

0
0
0.000
avatar

Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

Thanks for including @stemsocial as a beneficiary, which gives you stronger support. 
 

0
0
0.000