We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dcc4801 commit b449724Copy full SHA for b449724
src/Router.js
@@ -118,6 +118,15 @@ class Router {
118
* Route/Middleware function (optional).
119
*
120
* @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.
130
* router.use(function(req, res, next) {
131
* if (req.method() === 'POST') {
132
* res.status(405).send();
@@ -128,6 +137,7 @@ class Router {
137
138
* ..
139
140
+ * // Run function on URI path only.
141
* router.use('/api/test', function(req, res) {
142
* res.setHeader('Content-Type', 'text/html');
133
143
* res.status(200).send('Hello World');
0 commit comments