Express


Express is minimal and flexible NodeJS web application which has lot of features in both mobile and web applications.

Request

  • This has properties of query and strings, parameters, http headers and so on. This object is always referred to as req.

req.app()

This holds reference of instance of Express applications that using the middleware. This exports the middleware by “require”. Then the middleware can access the middleware.

req.baseUrl()

This is similar to the mount path property of the app object.

req.body()

Contains key value pairs of the data submitted in the request body.

req.cookies()

This property contains cookies sent by the object.

RESPONSE

  • res represents the http response after getting a http request. This originally determined with the parameters of the original function.

res.app()

This holds the properties for the instance of express application.

res.local()

This contains response local variables. This is impoertant when exposing request level information.

res.append()

Appends specific header for the http response header file.

ROUTER

  • Router object is an isolate object in middleware. This is capable only in performing middleware actions. This behaves as middleware itself. In top level there is a new router object.

router.all()

This is important to mapping global logic to specific paths. It requires all the routes from the point.

router.METHOD()

This provides the routing functionality in Express. This provides methods like GET, PUT, POST and so on.

router.param()

This adds call back triggers for the functions.

router.route()

This returs the instance of single routes in a specific manner.







Comments

Popular Posts