@@ -10,9 +10,9 @@ Visit <a href="https://resurface.io">resurface.io</a> for general information on
1010<ul >
1111<li ><a href =" #dependencies " >Dependencies</a ></li >
1212<li ><a href =" #installing_with_npm " >Installing With npm</a ></li >
13- <li ><a href =" #logging_from_express_route " >Logging From Express Route</a ></li >
1413<li ><a href =" #logging_from_express_middleware " >Logging From Express Middleware</a ></li >
1514<li ><a href =" #logging_from_apollo_server_on_express " >Logging From Apollo Server on Express</a ></li >
15+ <li ><a href =" #logging_from_express_route " >Logging From Specific Express Routes</a ></li >
1616<li ><a href =" #logging_with_api " >Logging With API</a ></li >
1717<li ><a href =" #privacy " >Protecting User Privacy</a ></li >
1818</ul >
@@ -31,30 +31,6 @@ Requires Node.js 8.x or later. No other dependencies to conflict with your app.
3131npm install resurfaceio-logger --save
3232```
3333
34- <a name =" logging_from_express_route " />
35-
36- ## Logging From Express Route
37-
38- After <a href =" #installing_with_npm " >installing the module</a >, create a logger and call it from the routes of interest.
39-
40- ``` js
41- const express = require (' express' );
42- const app = express ();
43-
44- const resurfaceio = require (' resurfaceio-logger' );
45- const logger = new resurfaceio.HttpLogger ({
46- url: ' https://...' ,
47- rules: ' include strict'
48- });
49-
50- app .get (' /' , function (request , response ) {
51- response .render (' pages/index' , function (e , html ) {
52- response .status (200 ).send (html);
53- resurfaceio .HttpMessage .send (logger, request, response, html);
54- });
55- });
56- ```
57-
5834<a name =" logging_from_express_middleware " />
5935
6036## Logging From Express Middleware
@@ -97,6 +73,30 @@ const server = new ApolloServer({ ... });
9773server .applyMiddleware ({ app });
9874```
9975
76+ <a name =" logging_from_express_route " />
77+
78+ ## Logging From Specific Express Routes
79+
80+ After <a href =" #installing_with_npm " >installing the module</a >, create a logger and call it from the routes of interest.
81+
82+ ``` js
83+ const express = require (' express' );
84+ const app = express ();
85+
86+ const resurfaceio = require (' resurfaceio-logger' );
87+ const logger = new resurfaceio.HttpLogger ({
88+ url: ' https://...' ,
89+ rules: ' include strict'
90+ });
91+
92+ app .get (' /' , function (request , response ) {
93+ response .render (' pages/index' , function (e , html ) {
94+ response .status (200 ).send (html);
95+ resurfaceio .HttpMessage .send (logger, request, response, html);
96+ });
97+ });
98+ ```
99+
100100<a name =" logging_with_api " />
101101
102102## Logging With API
0 commit comments