Showing posts with label Express. Show all posts
Showing posts with label Express. Show all posts

Thursday, March 9, 2017

Overview of Restify

Restify is a node.js module built specifically to enable you to build correct REST web services. It intentionally borrows heavily from express as that is more or less the de facto API for writing web applications on top of node.js

Sunday, March 5, 2017

Crud operations in Express

These are the middleware needed for CRUD operations in express
//web framework for node.js
var express= require('express')
//Gives an instance of express
var app=express();
//Used for post request and forms
var bodyParser=require('body-parser');
//MongoDB Object modeling tool designed to work in asynchronous environment
var mongoose = require('mongoose');

Custom middleware in Node


Middleware would inject between the call and the Route.

  • When a client sends a request, it is handled by the route in the router
  • This router would send a response back to the client
  • When we have a middleware it would take the request process it and and then forward that request to the route. Then the route would send the response to the client

Models in express



Steps involved in creating models in express js

  • First we need to import mongooose
  • To make it modular, Lets create a new folder named models and then create a new js file . In this example I am creating model named  user. It has 2 properties firstName and lastName.
  • Load the model into mongoose

Wednesday, February 1, 2017

Installation and validation for Express


Installation


1.we can Install express globally or locally
$ npm install express -g

2 .Create package.json file

Tuesday, January 31, 2017

Overview of Express (Web framework)



  • Fast opinionated, minimalist web framework for node.js
  • Provides thin layer of fundamental web application features,without obscuring Node features
  • Provides robust set of features for web and mobile applications
  • Built inside node.js
  • Its a npm package