File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # node-http-context
2- Get HttpContext from anywhere
1+ # Node Http Context
2+ Get http context anywhere in node/express application.
3+
4+ ## How to use it
5+
6+ Install: ` npm install --save node-http-context `
7+
8+ ``` js
9+ const express = require (' express' );
10+ const httpContext = require (' node-http-context' );
11+
12+ const app = express ();
13+ // Initialize Httpcontext middleware service
14+ HttpContext .Initilize (app);
15+ // After initialize the httpcontext we can get httpcontext anywhere
16+ ```
17+
18+ Get HttpContext form anywhare:
19+
20+ ``` js
21+ const httpContext = require (' node-http-context' );
22+
23+ // Node express request object from HttpContext
24+ httpContext .Request ;
25+
26+ // Node express response object from HttpContext
27+ httpContext .Response .send (HTML / STRING );
28+ httpContext .Response .json ({JSON_Object});
29+
30+ // Node express Next object from HttpContext
31+ httpContext .Next ();
32+
33+ // Node express session object from HttpContext
34+ httpContext .Session ;
35+ ```
36+
37+ ## Contributors
38+ * Devesh Kumar (@dkrockcom )
You can’t perform that action at this time.
0 commit comments