Express JS

Retry Connection Code – Node JS

Retry connecting to the server, database example code on Node JS Express JS. Making connection requests using try-catch block example and making a number... Read more »

React Bootstrap – Search Bar Input Box Code, With Location List

The search bar is an important component of websites with lots of pages. We can easily implement the search box in the header of... Read more »

Cookies and Sessions in Node Express JS, Mongo DB APP

Sessions and cookies play a very important role in a web app. These are used to store information. Cookies are used to store information... Read more »

bcrypt – Password Hashing for Package for Node Apps

bcrypt is a node library that enables password hashing. So we ca securely store the password of our Node Express Mongo Apps. Install bcrypt... Read more »

Data Encryption in Express Mongo DB App

For the encryption and authentication for mongoose documents, we can use a package called mongoose-encryption. Refer: https://www.npmjs.com/package/mongoose-encryption Install mongoose-encryption package npm i mongoose-encryption Using mongoose-encrytption... Read more »

REST API Delete – Remove Mongo DB Record

Delete a record in Mongo DB database using express js code. DELETE Request in REST API sample code example. app.route('/articles/:articleTitle').delete(function(req,res){ Article.deleteOne({title: req.params.articleTitle}, function(err){ if(err){... Read more »

REST API – PATCH – to Update some fields only in Mongo DB Record

PATCH request in REST API can be made to update particular fields in a particular record. It can alter certain fields without replacing entire... Read more »

Mongo DB “update()” not working – Alternative Code

Update() in mongo db is deprecated and it was used for updating a record. Now this function can be done using replaceOne() . Here... Read more »

REST API PUT – Update Mongo DB Record

Update a record in Mongo DB database using express js code. PUT Request in REST API sample code example. app.route('/articles/:articleTitle').put(function(req, res){ Article.replaceOne( {title: req.params.articleTitle},... Read more »

REST API – GET Specific DB Record – Using Dynamic URL Value

Query and retrieve a specific Mongo DB record using Express JS REST API. Mongo DB findOne() method usage for retrieving single record from the... Read more »