mirror of
https://github.com/expressjs/expressjs.com.git
synced 2026-02-21 19:41:33 +00:00
Update links to 5x api docs on use middleware page (#2039)
Co-authored-by: bjohansebas <103585995+bjohansebas@users.noreply.github.com>
This commit is contained in:
@@ -10,7 +10,7 @@ redirect_from: "/guide/using-middleware.html"
|
||||
|
||||
Express is a routing and middleware web framework that has minimal functionality of its own: An Express application is essentially a series of middleware function calls.
|
||||
|
||||
_Middleware_ functions are functions that have access to the [request object](/{{ page.lang }}/4x/api.html#req) (`req`), the [response object](/{{ page.lang }}/4x/api.html#res) (`res`), and the next middleware function in the application's request-response cycle. The next middleware function is commonly denoted by a variable named `next`.
|
||||
_Middleware_ functions are functions that have access to the [request object](/{{ page.lang }}/5x/api.html#req) (`req`), the [response object](/{{ page.lang }}/5x/api.html#res) (`res`), and the next middleware function in the application's request-response cycle. The next middleware function is commonly denoted by a variable named `next`.
|
||||
|
||||
Middleware functions can perform the following tasks:
|
||||
|
||||
@@ -34,7 +34,7 @@ You can also load a series of middleware functions together, which creates a sub
|
||||
|
||||
<h2 id='middleware.application'>Application-level middleware</h2>
|
||||
|
||||
Bind application-level middleware to an instance of the [app object](/{{ page.lang }}/4x/api.html#app) by using the `app.use()` and `app.METHOD()` functions, where `METHOD` is the HTTP method of the request that the middleware function handles (such as GET, PUT, or POST) in lowercase.
|
||||
Bind application-level middleware to an instance of the [app object](/{{ page.lang }}/5x/api.html#app) by using the `app.use()` and `app.METHOD()` functions, where `METHOD` is the HTTP method of the request that the middleware function handles (such as GET, PUT, or POST) in lowercase.
|
||||
|
||||
This example shows a middleware function with no mount path. The function is executed every time the app receives a request.
|
||||
|
||||
@@ -249,9 +249,9 @@ functions that were previously included with Express are now in separate modules
|
||||
|
||||
Express has the following built-in middleware functions:
|
||||
|
||||
- [express.static](/en/4x/api.html#express.static) serves static assets such as HTML files, images, and so on.
|
||||
- [express.json](/en/4x/api.html#express.json) parses incoming requests with JSON payloads. **NOTE: Available with Express 4.16.0+**
|
||||
- [express.urlencoded](/en/4x/api.html#express.urlencoded) parses incoming requests with URL-encoded payloads. **NOTE: Available with Express 4.16.0+**
|
||||
- [express.static](/en/5x/api.html#express.static) serves static assets such as HTML files, images, and so on.
|
||||
- [express.json](/en/5x/api.html#express.json) parses incoming requests with JSON payloads. **NOTE: Available with Express 4.16.0+**
|
||||
- [express.urlencoded](/en/5x/api.html#express.urlencoded) parses incoming requests with URL-encoded payloads. **NOTE: Available with Express 4.16.0+**
|
||||
|
||||
<h2 id='middleware.third-party'>Third-party middleware</h2>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user