{"id":23952,"date":"2019-02-18T12:15:23","date_gmt":"2019-02-18T10:15:23","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=23952"},"modified":"2019-02-15T17:26:05","modified_gmt":"2019-02-15T15:26:05","slug":"develop-restful-apis-using-mongodb-and-nodejs","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/","title":{"rendered":"Develop RESTful APIs using MongoDB and Nodejs"},"content":{"rendered":"\n<p>In this article, we will learn how to build\nRestful API\u2019s from scratch using node and NoSQL databases like MongoDB. For\nstarters let\u2019s understand our development stack before we start building our application.<\/p>\n\n\n\n<p>Node.js is an open source javascript runtime\ndesigned to build scalable applications and uses an event-driven and\nnon-blocking I\/O. Node.js is designed keeping low latency and streaming a\npriority which makes it well suited for a web library foundation. <\/p>\n\n\n\n<p>MongoDB is an open source NoSQL DB flavor\ndesigned to use document data models like JSON data structure. According to the\nMongoDB website: \u201cMongoDB is a document database with the scalability and\nflexibility that you want with the querying and indexing that you need\u201d. To\nlearn more about MongoDB has very good<a href=\"https:\/\/docs.mongodb.com\/manual\/?_ga=2.195422254.388863106.1549770060-733930490.1549592842\"> <\/a><a href=\"https:\/\/docs.mongodb.com\/manual\/?_ga=2.195422254.388863106.1549770060-733930490.1549592842\">documentation<\/a> that is worth a read<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Download and install Node<\/li><li>MongoDB installation<\/li><li>Install Express Server<\/li><li>Download Postman client to test\nour API\u2019s<\/li><li>Your favorite text editor or IDE\u2019s\nlike Atom, sublime or JetBrains<\/li><li>Terminal installed<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">1.1 Download and install Node<\/h3>\n\n\n\n<p>Node.js can be downloaded and installed in\nmultiple flavors and operation systems. Follow the<a href=\"https:\/\/nodejs.org\/en\/download\/\"> <\/a><a href=\"https:\/\/nodejs.org\/en\/download\/\">node documentation link<\/a> and pick\nthe right install that works best. If you were to use Mac follow the\ninstructions provided below<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Click on macOS installer and open\nthe downloaded .pkg file, in our case node-v10.15.1.pkg is the file name<\/li><li>Click on continue to proceed with\nthe installer<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"830\" height=\"574\" src=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2019\/02\/Node_install_watermark-1.png\" alt=\"RESTful APIs using MongoDB and Nodejs - Node Js Installer\" class=\"wp-image-24034\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2019\/02\/Node_install_watermark-1.png 830w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2019\/02\/Node_install_watermark-1-300x207.png 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2019\/02\/Node_install_watermark-1-768x531.png 768w\" sizes=\"(max-width: 830px) 100vw, 830px\" \/><figcaption>Node Js Installer<\/figcaption><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Follow instructions on the screen to complete the installation successfully<\/li><li>Confirm node is installed successfully by checking the version installed<\/li><li><\/li><\/ul>\n\n\n\n<span style=\"text-decoration: underline\"><em>Check node version installed<\/em><\/span>\n\n\n\n<pre class=\"brush:bash\">$ node -v\nv10.15.1<\/pre>\n\n\n\n<p>Congrats, you have node installed successfully\nand let\u2019s start with MongoDB installation<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1.2 MongoDB Installation<\/h3>\n\n\n\n<p>MongoDB can be installed manually by\ndownloading the install or Homebrew.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Navigate to MongoDB community\nServer page if you would like to install manually &#8211;<a href=\"https:\/\/www.mongodb.com\/download-center\/community\"> <\/a><a href=\"https:\/\/www.mongodb.com\/download-center\/community\">https:\/\/www.mongodb.com\/download-center\/community<\/a>\n<\/li><li>Install using homebrew install<\/li><\/ul>\n\n\n\n<span style=\"text-decoration: underline\"><em>Install Mongo using brew<\/em><\/span>\n\n\n\n<pre class=\"brush:bash\"> $ brew install mongodb\nUpdating Homebrew...\n==&gt; Installing dependencies for mongodb: openssl, readline, sqlite and python@2\n==&gt; Installing mongodb\n==&gt; mongodb\nTo have launchd start mongodb now and restart at login:\nbrew services start mongodb\nOr, if you don't want\/need a background service you can just run:\n  mongod --config \/usr\/local\/etc\/mongod.conf\n<\/pre>\n\n\n\n<p>To check if mongo is installed successfully<\/p>\n\n\n\n<span style=\"text-decoration: underline\"><em>Mongo install success<\/em><\/span>\n\n\n\n<pre class=\"brush:bash\">$ which mongo\n\/usr\/local\/bin\/mongo\n<\/pre>\n\n\n\n<p>To start the MongoDB server:<\/p>\n\n\n\n<span style=\"text-decoration: underline\"><em>Start Mongo server<\/em><\/span>\n\n\n\n<pre class=\"brush:bash\">$ brew services start mongodb\n==&gt; Successfully started mongodb\n<\/pre>\n\n\n\n<p>Test your connection to mongodb:<\/p>\n\n\n\n<span style=\"text-decoration: underline\"><em>Check Mongo connection<\/em><\/span>\n\n\n\n<pre class=\"brush:bash\">$ mongo\nMongoDB shell version v4.0.3\nconnecting to: mongodb:\/\/127.0.0.1:27017\n<\/pre>\n\n\n\n<p>Now we have MongoDB installed let\u2019s quickly\ninstall postman so we can start building our API\u2019s.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1.3 Download Postman client<\/h3>\n\n\n\n<p>Postman is a Graphical User Interface (GUI)\nHTTP client used for testing API services by constructing API request with a\nreadable API response. Postman client can be downloaded from<a href=\"https:\/\/www.getpostman.com\/downloads\/\"> <\/a><a href=\"https:\/\/www.getpostman.com\/downloads\/\">https:\/\/www.getpostman.com\/downloads\/<\/a>\nand follow on-screen installations for a successful installation.<\/p>\n\n\n\n<p>Now we have our development stack installed\nand we are ready to start building API\u2019s. Let\u2019s build an app that stores\nproduct information and let\u2019s call it Product Catalog. To start creating the\napp we will open terminal and create a folder with name product-catalog-api and\nfrom the root directory create package.json file following steps below:<\/p>\n\n\n\n<span style=\"text-decoration: underline\"><em>Creating product directory structure<\/em><\/span>\n\n\n\n<pre class=\"brush:bash\">$ mkdir product-catalog-api\n$ cd product-catalog-api\n$ npm init\n<\/pre>\n\n\n\n<p>Make any changes to the package.json from the\nterminal or you can always make changes later, here\u2019s my copy with some details\nadded<\/p>\n\n\n\n<span style=\"text-decoration: underline\"><em>Modify package file \n with updates<\/em><\/span>\n\n\n\n<pre class=\"brush:json\"> {\n     \"name\": \"product-catalog-api\",\n     \"version\": \"1.0.0\",\n     \"description\": \"Sample   Product Catalog app using node and mongodb\",\n     \"main\": \"index.js\",\n     \"scripts\": {\n       \"test\": \"echo \\\"Error: no test   specified\\\" &amp;&amp; exit 1\"\n     },\n     \"author\": \"RM\",\n     \"license\":\"ISC\"\n<\/pre>\n\n\n\n<p>Now we created package file which is the\nstarting file for node server to recognize steps to start the server, let\u2019s\ncreate a folder api and create controller, model and routes folder respectively<\/p>\n\n\n\n<span style=\"text-decoration: underline\"><em>create MVC structure<\/em><\/span>\n\n\n\n<pre class=\"brush:bash\">$ mkdir api\n$ cd api\n$ mkdir contollers\n$ mkdir models\n$ mkdir routes\n$ cd ..\/ &amp;&amp; touch server.js\n<\/pre>\n\n\n\n<p>Here\u2019s the folder structure after the files are created:<\/p>\n\n\n\n<p>Structure should include a folder api and controllers, models and routes as subfolders in it. Make sure package.json and server.js files are part of the api folder.<\/p>\n\n\n\n<p>We are ready to create our first model,\ncontroller files along with routes.<\/p>\n\n\n\n<span style=\"text-decoration: underline\"><em>Create controller, model and routes<\/em><\/span>\n\n\n\n<pre class=\"brush:bash\">$ touch api\/controllers\/productCatalogController.js \n$ touch api\/models\/productCatalogModel.js\n$ touch api\/routes\/productCatalogRoutes.js\n<\/pre>\n\n\n\n<p>It\u2019s time to create our server using express\nand npm commands<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1.4 Express Server Installation<\/h3>\n\n\n\n<p>According to the expressjs.com site: <\/p>\n\n\n\n<p>\u201cExpress is a minimal and flexible Node.js web\napplication framework that provides a robust set of features for web and mobile\napplications.\u201d <\/p>\n\n\n\n<p>Express.js is designed to build hybrid web\napplications both single and multi-page apps. Express.js is the most popularly\nused framework for node.js applications providing a thin layer for web\napplications without hindering the node.js features<\/p>\n\n\n\n<span style=\"text-decoration: underline\"><em>Install express and nodemon<\/em><\/span>\n\n\n\n<pre class=\"brush:bash\">$ npm install express --save\n$ npm install --save-dev nodemon\n<\/pre>\n\n\n\n<p>On successful installation, additional folder\nwith name node_modules will be created with all express dependencies installed\nand saved. We will use nodemon server.js to start the application server. Add\nthe line inside the package.json file to automatically start the server.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1.5 Install Mongoose library<\/h3>\n\n\n\n<p>Mongoose library is widely used as an Object\nData Modeling (ODM) for MongoDB and node applications. Mongoose takes care of\nrelationships between data and schema validations, check how.<\/p>\n\n\n\n<p>Let\u2019s start by installing mongoose using npm\npackage<\/p>\n\n\n\n<span style=\"text-decoration: underline\"><em>Install mongoose using npm package<\/em><\/span>\n\n\n\n<pre class=\"brush:bash\">$ npm install mongoose --save\n<\/pre>\n\n\n\n<p>If you noticed changes in the codebase,\npackage.json, and package-lock.json are updated from the npm install command\nalong with mongoose folder inside a node-module folder. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Create a Product Schema<\/h2>\n\n\n\n<p>Let\u2019s start defining our Product catalog model\nby adding a schema that would identify product like:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Name\n\u2192 Identifies the name of the Product<\/li><li>Description\n\u2192 Identifies the description of the Product<\/li><li>Price\n\u2192 Identifies the price of the Product<\/li><li>Currency\n\u2192 Identifies the currency of the Product<\/li><li>Created\nat \u2192 Identifies product creation timestamp<\/li><li>Updated\nat \u2192 Identifies product timestamp last updated timestamp<\/li><\/ul>\n\n\n\n<p>Let\u2019s define the schema into mongoose and\nnodejs nomenclature by adding the code below into the <em>productCatalogModel.js<\/em> file and save. The code below is\nself-explanatory with Model and schema defined with the collections mentioned\nabove. <\/p>\n\n\n\n<span style=\"text-decoration: underline\"><em>Schema Definition for Product Model<\/em><\/span>\n\n\n\n<pre class=\"brush:js\">   'use strict';\n   var <code>mongoose<\/code> = require('mongoose');\n   var <code>Schema<\/code> = mongoose.Schema;\n   \n   \n   var <code>ProductSchema<\/code> = new Schema({\n     name: {\n       type: String,\n       required: 'Enter Product Name'\n     },\n     description: {\n       type: String,\n       required: 'Enter Product Description'\n     },\n     price: {\n       type: Number,\n       required: 'Enter Product Price'\n     },\n     currency: {\n       type: String,\n       required: 'Enter Product Currency'\n     },\n     Created_date: {\n       type: Date,\n       default: Date.now\n     },\n     Updated_date: {\n       type: Date,\n       default: Date.now\n     }\n   });\n   \n   module.exports = mongoose.model('<code>Products<\/code>',  <code> ProductSchema<\/code>);   \n<\/pre>\n\n\n\n<p>Let\u2019s create our controller with actions to\nlist, create, read, update and delete a product from the product catalog.\nThanks to Mongoose methods and node.js exported functions. Modify the\ncontroller file productCatalogController.js file as mentioned below<\/p>\n\n\n\n<span style=\"text-decoration: underline\"><em>CRUD Operations using mongoose<\/em><\/span>\n\n\n\n<pre class=\"brush:js\">   'use strict';\n   \n   var <code>mongoose<\/code> = require('mongoose'),\n     <code>Product<\/code> = mongoose.model('Products');\n   \n   exports.list_all_products = function(req, res) {\n     <code>Product.find<\/code>({}, function(err, product) {\n       if (err)\n         res.send(err);\n       res.json(product);\n     });\n   };\n   \n   exports.create_a_product = function(req, res) {\n     var new_product   = new Product(req.body);\n     new_product.save(function(err, product) {\n       if (err)\n         res.send(err);\n       res.json(product);\n     });\n   };\n   \n   \n   exports.read_a_product = function(req, res) {\n       Product.findById(req.params.productId, function(err,   product) {\n       if (err)\n         res.send(err);\n       res.json(product);\n     });\n   };\n   \n   \n   exports.update_a_product = function(req, res) {\n     <code>Product.findOneAndUpdate<\/code>({_id:   req.params.productId}, req.body, {new: true}, function(err, product) {\n       if (err)\n         res.send(err);\n       res.json(product);\n     });\n   };\n   \n   \n   exports.delete_a_product = function(req, res) {\n   \n   \n     Product.remove({\n       _id: req.params.productId\n     }, function(err,   product) {\n       if (err)\n         res.send(err);\n       res.json({ message: 'Product successfully deleted' });\n     });\n   };   \n<\/pre>\n\n\n\n<p>Let\u2019s put this all together by modifying the\nroutes file productCatalogRoutes.js file to let our app know the routes when a\nparticular action is called<\/p>\n\n\n\n<span style=\"text-decoration: underline\"><em>Modify routes to match the controllers<\/em><\/span>\n\n\n\n<pre class=\"brush:js\">   'use strict';\n   module.exports = function(app) {\n     var productList   = require('..\/controllers\/productCatalogController');\n   \n     \/\/ todoList Routes\n     app.route('\/products')\n       .get(productList.list_all_products)\n         .post(productList.create_a_product);\n   \n   \n     app.route('\/products\/:productId')\n       .get(productList.read_a_product)\n       .put(productList.update_a_product)\n         .delete(productList.delete_a_product);\n   };   \n<\/pre>\n\n\n\n<p>Finally let\u2019s add our Model and Mongoose\nconnection details in our server.js file we created at the start of the\nproject.&nbsp; <\/p>\n\n\n\n<span style=\"text-decoration: underline\"><em>Update DB connection details to connect to mongoose on server file<\/em><\/span>\n\n\n\n<pre class=\"brush:js\">   var express = require('express'),\n     app = express(),\n     port = process.env.PORT || 3000\n     mongoose = require('mongoose'),\n     Product = require('.\/api\/models\/productCatalogModel'),\n     bodyParser = require('body-parser');\n   \n   \/\/ mongoose instance connection   url connection\n   mongoose.Promise = global.Promise;\n   mongoose.connect('mongodb:\/\/localhost\/ProductCatalogdb');\n   \n   app.use(bodyParser.urlencoded({ extended: true }));\n   app.use(bodyParser.json());\n   \n   var routes = require('.\/api\/routes\/productCatalogRoutes'); \/\/importing   route\n   routes(app);\n   \n   app.listen(port);\n   \n   console.log('Product   Catalog RESTful API server started on: ' + port);   \n<\/pre>\n\n\n\n<p>The final step is to start your MongoDB\nserver, node servers to connect to MongoDB instance.<\/p>\n\n\n\n<span style=\"text-decoration: underline\"><em>start mongo server<\/em><\/span>\n\n\n\n<pre class=\"brush:bash\">$ mongod\n<\/pre>\n\n\n\n<p>API\u2019s built should function with all actions\nmentioned in the controller and use postman to test your API\u2019s by sending a\nrequest, for e.g use the URL below to list all products successfully from your\nlocal instance.<\/p>\n\n\n\n<p><a href=\"http:\/\/localhost:3000\/products\">http:\/\/localhost:3000\/products<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. References<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>CRUD Operation reference from MongoDB site: <a href=\"http:\/\/mongodb.github.io\/node-mongodb-native\/3.1\/tutorials\/crud\/\">http:\/\/mongodb.github.io\/node-mongodb-native\/3.1\/tutorials\/crud\/<\/a><\/li><li>Mongoose DB Schema definitions: <a href=\"https:\/\/mongoosejs.com\/docs\/guide.html\">https:\/\/mongoosejs.com\/docs\/guide.html<\/a><\/li><li>How to use MongoDB with node.js: <a href=\"https:\/\/flaviocopes.com\/node-mongodb\/\">https:\/\/flaviocopes.com\/node-mongodb\/<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will learn how to build Restful API\u2019s from scratch using node and NoSQL databases like MongoDB. For starters let\u2019s understand our development stack before we start building our application. Node.js is an open source javascript runtime designed to build scalable applications and uses an event-driven and non-blocking I\/O. Node.js is designed &hellip;<\/p>\n","protected":false},"author":11501,"featured_media":924,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[57],"class_list":["post-23952","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-node-js","tag-mongodb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Develop RESTful APIs using MongoDB and Nodejs - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"Interested to learn more about RESTful APIs? Then check out our detailed Develop RESTful APIs using MongoDB and Nodejs!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Develop RESTful APIs using MongoDB and Nodejs - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"Interested to learn more about RESTful APIs? Then check out our detailed Develop RESTful APIs using MongoDB and Nodejs!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2019-02-18T10:15:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ram Manusani\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ram Manusani\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/\"},\"author\":{\"name\":\"Ram Manusani\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1a342c799debc7e5259dda110f63f90b\"},\"headline\":\"Develop RESTful APIs using MongoDB and Nodejs\",\"datePublished\":\"2019-02-18T10:15:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/\"},\"wordCount\":1115,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg\",\"keywords\":[\"MongoDB\"],\"articleSection\":[\"Node.js\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/\",\"name\":\"Develop RESTful APIs using MongoDB and Nodejs - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg\",\"datePublished\":\"2019-02-18T10:15:23+00:00\",\"description\":\"Interested to learn more about RESTful APIs? Then check out our detailed Develop RESTful APIs using MongoDB and Nodejs!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Node.js\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/node-js\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Develop RESTful APIs using MongoDB and Nodejs\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1a342c799debc7e5259dda110f63f90b\",\"name\":\"Ram Manusani\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e590678367b9c0e6359dbcd7c292eebb909a3bffc565ae9f18bda9fec446212a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e590678367b9c0e6359dbcd7c292eebb909a3bffc565ae9f18bda9fec446212a?s=96&d=mm&r=g\",\"caption\":\"Ram Manusani\"},\"description\":\"A passionate and committed technology polyglot with extensive experience in Web, Mobile, Enterprise, Health, Gaming, Entertainment, and CRM verticals. With over a decade of digital marketing experience in CMS and portal technologies with hands-on developing and architecting experience in Ruby on Rails, Liferay, Adobe CQ5 and Java technologies. Extensively involved in implementing and adapting technically sophisticated web applications using Ruby, Ruby on Rails, MongoDB and node.js\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/rammanusani\/\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/ram-manusani\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Develop RESTful APIs using MongoDB and Nodejs - Web Code Geeks - 2026","description":"Interested to learn more about RESTful APIs? Then check out our detailed Develop RESTful APIs using MongoDB and Nodejs!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/","og_locale":"en_US","og_type":"article","og_title":"Develop RESTful APIs using MongoDB and Nodejs - Web Code Geeks - 2026","og_description":"Interested to learn more about RESTful APIs? Then check out our detailed Develop RESTful APIs using MongoDB and Nodejs!","og_url":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2019-02-18T10:15:23+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg","type":"image\/jpeg"}],"author":"Ram Manusani","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Ram Manusani","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/"},"author":{"name":"Ram Manusani","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1a342c799debc7e5259dda110f63f90b"},"headline":"Develop RESTful APIs using MongoDB and Nodejs","datePublished":"2019-02-18T10:15:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/"},"wordCount":1115,"commentCount":1,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg","keywords":["MongoDB"],"articleSection":["Node.js"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/","url":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/","name":"Develop RESTful APIs using MongoDB and Nodejs - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg","datePublished":"2019-02-18T10:15:23+00:00","description":"Interested to learn more about RESTful APIs? Then check out our detailed Develop RESTful APIs using MongoDB and Nodejs!","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/develop-restful-apis-using-mongodb-and-nodejs\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"Node.js","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/node-js\/"},{"@type":"ListItem","position":4,"name":"Develop RESTful APIs using MongoDB and Nodejs"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1a342c799debc7e5259dda110f63f90b","name":"Ram Manusani","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e590678367b9c0e6359dbcd7c292eebb909a3bffc565ae9f18bda9fec446212a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e590678367b9c0e6359dbcd7c292eebb909a3bffc565ae9f18bda9fec446212a?s=96&d=mm&r=g","caption":"Ram Manusani"},"description":"A passionate and committed technology polyglot with extensive experience in Web, Mobile, Enterprise, Health, Gaming, Entertainment, and CRM verticals. With over a decade of digital marketing experience in CMS and portal technologies with hands-on developing and architecting experience in Ruby on Rails, Liferay, Adobe CQ5 and Java technologies. Extensively involved in implementing and adapting technically sophisticated web applications using Ruby, Ruby on Rails, MongoDB and node.js","sameAs":["https:\/\/www.linkedin.com\/in\/rammanusani\/"],"url":"https:\/\/www.webcodegeeks.com\/author\/ram-manusani\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/23952","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/11501"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=23952"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/23952\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/924"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=23952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=23952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=23952"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}