Connecting MongoDB with RESTFUL API and Express JS
Connect MongoDB with node js API
“Application Programming Interface” Think of an API like a menu in a restaurant. The menu provides a list of dishes you can order, along with a description of each dish. When you specify what menu items you want, the restaurant’s kitchen does the work and provides you with some finished dishes. You don’t know exactly how the restaurant prepares that food, and you don’t really need to.
These days, APIs are especially important because they dictate how developers can create new apps that tap into big Web services—social networks like Facebook or Pinterest, for instance, or utilities like Google Maps or Dropbox. The developer of a game app, for instance, can use the Dropbox API to let users store their saved games in the Dropbox cloud instead of working out some other cloud-storage option from scratch.
Postman is a Google Chrome app for interacting with HTTP APIs. It presents you with a friendly GUI for constructing requests and reading responses. The people behind Postman also offer an add-on package called Jetpacks, which includes some automation tools and, most crucially, a Javascript testing library
In REST, the resource typically refers to some object or set of objects that are exposed at an API endpoint. An endpoint by itself is just a reference to a uri that accepts web requests that may or may not be RESTful. Service Endpoint: A Webservice that is addressable using a WS-Addressing endpoint reference.
It allows for repeatable, reliable tests that can be automated and used in a variety of environments and includes useful tools for persisting data and simulating how a user might actually be interacting with the system.
Express.js, or simply Express, is a web application framework for Node.js. ou can then use a database like MongoDB with Mongoose (for modeling) to provide a backend for your Node.js application. Express.js basically helps you manage everything, from routes, to handling requests and views. Redis is a key/value store -- commonly used for sessions and caching in Node.js applications.
Object validation server side is a necessity for public web services — the realisation of this necessity became Joi — the most widely adopted package for object schema descriptions and validation. Joi allows us to create blueprints of Javascript objects that ensure that we process and ultimately accept accurate data.
Express 3.x is a light-weight web application framework to help organize your web application into an MVC architecture on the server side. You can use a variety of choices for your templating language (like EJS, Jade, and Dust.js). You can then use a database like MongoDB with Mongoose (for modeling) to provide a backend for your Node.js application. Express.js basically helps you manage everything, from routes, to handling requests and views. Redis is a key/value store -- commonly used for sessions and caching in Node.js applications. You can do a lot more with it, but that's what I'm using it for. I use MongoDB for more complex relationships, like line-item <-> order <- user relationships. There are modules (most notably connect-redis) that will work with Express.js. You will need to install the Redis database on your server.
after installing NPM packages and PostMan you will be able to move freely btween the routes # GET # POST # DELETE # PUT