Skip to content

Commit

Permalink
Add require for express in middleware examples
Browse files Browse the repository at this point in the history
closes #1158
  • Loading branch information
AqibMukhtar authored and dougwilson committed Jun 3, 2020
1 parent 9d9a1f7 commit a80bd8a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions en/guide/using-middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Bind application-level middleware to an instance of the [app object](/{{ page.la
This example shows a middleware function with no mount path. The function is executed every time the app receives a request.

```js
var express = require('express')
var app = express()

app.use(function (req, res, next) {
Expand Down Expand Up @@ -150,6 +151,7 @@ Load router-level middleware by using the `router.use()` and `router.METHOD()` f
The following example code replicates the middleware system that is shown above for application-level middleware, by using router-level middleware:

```js
var express = require('express')
var app = express()
var router = express.Router()

Expand Down Expand Up @@ -195,6 +197,7 @@ to pass control back out of the router instance.
This example shows a middleware sub-stack that handles GET requests to the `/user/:id` path.

```js
var express = require('express')
var app = express()
var router = express.Router()

Expand Down

0 comments on commit a80bd8a

Please sign in to comment.