Alibabacloud.com offers a wide variety of articles about direct express routing number, easily find your direct express routing number information here online.
server, it is important to decide how to respond to a request for a path, or to route a process.
The most direct route configuration method is to invoke App.get (), App.post () a piece of configuration, but for the site that needs to deal with a large number of routes, this will be fatal. So, we need to combine routing parameters (query string, regular expressio
This article mainly introduces the path ing (Routing) function and control of NodeJS framework express, which has some reference value. If you are interested, you can refer to it. This article mainly introduces the detailed description of NodeJS # css/css-rwd-frameworks.html "target =" _ blank "> framework express path ing (R
/jquery.js "/file/*.*"/files/jquery.js/files/ Javascripts/jquery.js "/user/:id/:operation?" /user/1/user/1/edit "/products.:format"/products.json/products.xml "/products.:format?" /products.json/products.xml/products "/user/:id.:format?" /user/12/user/12.json In addition, we can submit JSON data by post, and then use Bodyparser middleware to parse the JSON request body and return the JSON data to the client: var express = require ('
Routing
Routing is how to define an application's endpoint (URIs) and how to respond to a client's request.
A route consists of a URI, an HTTP request (get, post, and so on) and a number of handles, which are structured as follows: App. Method (path, [callback ...], callback), the app is an instance of the Express ob
. Return status code does not need to pass Res.setstatecode (), can use Res.send (), can also return Chinese, do not need to set the response header type, can automatically set the returned response header type according to the returned data typeapp.get("/send",function (req,res) { // res.send("中文") res.send(200)});Encapsulation of the Send () methodapp.use(function (req,res,next) { res.mySend = function (data) { if(typeof data === ‘object‘){ res.setHeader(‘Content-Typ
required, that is, one of the solution of the problem, according to the conditions of SQL query to do lock processing at the cache server level, the same request is placed only one to the back-end database, other requests block waiting for data updates.
The second is to block the peak of these cache failures, do not allow direct connection to the database for query, the cache server to the database initiated by the request processing all use the queu
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.