The term coarse is understood to Middleware (middleware) of

Excerpt from "Node.js Advanced Programming," a book Chinese version p197:

----------------------------------------------------------------------------

When building HTTP server application, it usually takes to perform common tasks, such as the head of analytical cookies, query string on the URL resolution request, the maintenance associated with the session, the session persistence data submitted static file, parses the request body, records request and response and others. When the core logic of the application to be encoded without explicitly performing these tasks, they should be handled by the HTTP server application logic.

Some tasks involve check request - the request header or request body - and others involve checking modify the response, there are two or more tasks are involved. An example of such a task that needs to perform both: to arrive simultaneously recording each request for details of the HTTP status code is also recorded in the corresponding response, in which case both the need to check the request object, also need to check response object. You might also want to set or modify response headers, such as the use of browser cookies to maintain session ID when.

In similar to a typical HTTP application framework Django, Cake, Rails Sinatra or the like, components for performing these tasks are usually referred middleware (middleware). The middleware component request - response cycle packaging, before reaching the application code extension request to modify the object or before and after the response.

--------------------------------------------------------------------------------

Analysis: between molding from raw materials to finished product, a number of procedures, each procedure, that is a middleware, which it will be closed, in order to call directly use. (The thought of being the first, to be completed ...)

Guess you like

Origin www.cnblogs.com/sx00xs/p/11518495.html