Skip to content

Commit b449724

Browse files
committed
Added comments to router.use @example
1 parent dcc4801 commit b449724

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Router.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ class Router {
118118
* Route/Middleware function (optional).
119119
*
120120
* @example
121+
* // Include function as middleware.
122+
* const Middleware = require('./path/to/middleware');
123+
*
124+
* router.use(Middleware);
125+
*
126+
* ..
127+
*
128+
*
129+
* // Run function for every request.
121130
* router.use(function(req, res, next) {
122131
* if (req.method() === 'POST') {
123132
* res.status(405).send();
@@ -128,6 +137,7 @@ class Router {
128137
*
129138
* ..
130139
*
140+
* // Run function on URI path only.
131141
* router.use('/api/test', function(req, res) {
132142
* res.setHeader('Content-Type', 'text/html');
133143
* res.status(200).send('Hello World');

0 commit comments

Comments
 (0)