Convert JavaScript Objects to JSON

The advantage of converting a JavaScript object into a properly formatted JSON string is that it makes it simple to store the string form in a file or database, send it across an HTTP connection, or write it to a stream or buffer. The JSON.stringify(object) method can be used to parse a JavaScript object and […]
Continue reading…

Enjoyed this post? Share it!

 
 

Connecting to a MongoDB server using Mongoose

Below is a sample code for connecting to a MongoDB server using Mongoose, a popular Node.js MongoDB ODM module: mongoose.connect(‘mongodb://localhost/app’); mongoose.connection.on(‘open’, function() { console.log(“Connected to Mongoose…”); });
Continue reading…

Enjoyed this post? Share it!