As you saw earlier, raw Node.js gives you one request handler function dịch - As you saw earlier, raw Node.js gives you one request handler function Việt làm thế nào để nói

As you saw earlier, raw Node.js giv

As you saw earlier, raw Node.js gives you one request handler function to work with.
The request comes into your function and the response goes out of your function.
Middleware is poorly named, but it’s a term that’s not Express-specific and has been
around for a while. The idea is pretty simple: rather than one monolithic request handler function, you call several request handler functions that each deal with a small
chunk of the work. These smaller request handler functions are called middleware functions, or middleware.
Middleware can handle tasks from logging requests to sending static files to setting
HTTP headers. The first middleware function you might use in an application is a logger—it logs every request that comes into your server. When the logger has finished
logging, it will continue on to the next middleware in the chain. This next middleware
function might authenticate users. If they’re visiting a forbidden URL, it will respond
with a “not authorized” page. If they are allowed to visit it, they can continue to the
next function in the chain. The next function might send the homepage and be done.
An illustration of two possible options is shown in figure 1.4.
In figure 1.4, the logging middleware is first in the chain and is always called, so
something will always be noted in the log file. Next, the logging middleware continues
to the next one in the chain, the authorization middleware. The authorization middleware decides, by some decree, whether the user is authorized to keep going. If they
are, the authorization middleware signals that it wants to continue on to the next middleware in the chain. Otherwise, the middleware sends a “you’re not authorized!”
message to the user and halts the chain. (This message could be an HTML page or a
JSON response or anything else, depending on the application.) The last middleware,if it’s called, will send secret information and not continue to any further middleware
in the chain. (Once again, this last middleware can send any kind of response, from
HTML to JSON to an image file.)
One of the biggest features of middleware is that it’s relatively standardized, which
means that lots of people have developed middleware for Express (including folks on
the Express team). That means that if you can dream up the middleware, someone
has probably already made it. There’s middleware to compile static assets like LESS
and SCSS; there’s middleware for security and user authentication; there’s middleware
to parse cookies and sessions
0/5000
Từ: -
Sang: -
Kết quả (Việt) 1: [Sao chép]
Sao chép!
As you saw earlier, raw Node.js gives you one request handler function to work with.The request comes into your function and the response goes out of your function.Middleware is poorly named, but it’s a term that’s not Express-specific and has beenaround for a while. The idea is pretty simple: rather than one monolithic request handler function, you call several request handler functions that each deal with a smallchunk of the work. These smaller request handler functions are called middleware functions, or middleware.Middleware can handle tasks from logging requests to sending static files to settingHTTP headers. The first middleware function you might use in an application is a logger—it logs every request that comes into your server. When the logger has finishedlogging, it will continue on to the next middleware in the chain. This next middlewarefunction might authenticate users. If they’re visiting a forbidden URL, it will respondwith a “not authorized” page. If they are allowed to visit it, they can continue to thenext function in the chain. The next function might send the homepage and be done.An illustration of two possible options is shown in figure 1.4.In figure 1.4, the logging middleware is first in the chain and is always called, sosomething will always be noted in the log file. Next, the logging middleware continuesto the next one in the chain, the authorization middleware. The authorization middleware decides, by some decree, whether the user is authorized to keep going. If theyare, the authorization middleware signals that it wants to continue on to the next middleware in the chain. Otherwise, the middleware sends a “you’re not authorized!”message to the user and halts the chain. (This message could be an HTML page or aJSON response or anything else, depending on the application.) The last middleware,if it’s called, will send secret information and not continue to any further middlewarein the chain. (Once again, this last middleware can send any kind of response, fromHTML to JSON to an image file.)One of the biggest features of middleware is that it’s relatively standardized, whichmeans that lots of people have developed middleware for Express (including folks onthe Express team). That means that if you can dream up the middleware, someonehas probably already made it. There’s middleware to compile static assets like LESSand SCSS; there’s middleware for security and user authentication; there’s middlewareto parse cookies and sessions
đang được dịch, vui lòng đợi..
Kết quả (Việt) 2:[Sao chép]
Sao chép!
Như bạn đã thấy ở trên, liệu Node.js cung cấp cho bạn một chức năng yêu cầu xử lý để làm việc với.
Các yêu cầu đi vào chức năng của bạn và phản ứng đi ra khỏi chức năng của bạn.
Middleware là kém tên, nhưng nó là một thuật ngữ không Thể hiện cụ thể và có được
khoảng một thời gian. Ý tưởng là khá đơn giản: thay vì hơn một chức năng yêu cầu xử lý nguyên khối, bạn gọi một số chức năng yêu cầu xử lý mà mỗi đối phó với một nhỏ
đoạn của công việc. Các chức năng xử lý yêu cầu nhỏ hơn được gọi là chức năng trung gian, hoặc trung gian.
Middleware có thể xử lý các tác vụ từ yêu cầu đăng nhập để gửi các file tĩnh để thiết lập
tiêu đề HTTP. Các chức năng trung gian đầu tiên bạn có thể sử dụng trong một ứng dụng là một logger-nó ghi mọi yêu cầu mà đi vào máy chủ của bạn. Khi logger đã hoàn thành
khai thác gỗ, nó sẽ tiếp tục đến các trung gian tiếp theo trong chuỗi. Trung gian tiếp theo này
chức năng có thể xác thực người dùng. Nếu họ đang truy cập một URL bị cấm, nó sẽ phản ứng
với một trang "không được phép". Nếu họ được phép truy cập vào nó, họ có thể tiếp tục các
chức năng tiếp theo trong chuỗi. Các chức năng sau có thể gửi trang web và được thực hiện.
Một minh họa cho hai lựa chọn có thể được thể hiện trong hình 1.4.
Trong hình 1.4, trung khai thác gỗ là lần đầu tiên trong chuỗi và luôn được gọi, vì vậy
một cái gì đó sẽ luôn được ghi chú trong tập tin đăng nhập . Tiếp theo, các trung khai thác gỗ vẫn tiếp tục
kế tiếp trong chuỗi, các trung gian cho phép. Các trung gian uỷ quyền quyết định, bởi một số nghị định, cho dù người dùng được phép để tiếp tục đi. Nếu họ
đang có, những tín hiệu cho phép trung gian mà nó muốn tiếp tục đi đến các trung gian tiếp theo trong chuỗi. Nếu không, middleware gửi một "bạn không được phép!"
Nhắn cho người sử dụng và ngừng chuỗi. (Thông báo này có thể là một trang HTML hoặc một
phản ứng JSON hoặc bất cứ điều gì khác, tùy thuộc vào ứng dụng.) Các trung gian cuối cùng, nếu nó được gọi là, sẽ gửi thông tin bí mật và không tiếp tục bất kỳ trung gian hơn nữa
trong chuỗi. (Một lần nữa, middleware cuối cùng này có thể gửi bất kỳ loại phản ứng, từ
HTML sang JSON vào một tập tin hình ảnh.)
Một trong những tính năng lớn nhất của trung là nó là tương đối chuẩn, mà
có nghĩa là rất nhiều người đã phát triển trung gian cho Express (bao gồm cả folks trên
đội Express). Điều đó có nghĩa rằng nếu bạn có thể ước mơ lên các trung gian, một người nào đó
có lẽ đã làm cho nó. Có trung gian để biên dịch tài sản tĩnh như LESS
và SCSS; có trung gian để xác thực bảo mật và sử dụng; có trung gian
để phân tích các tập tin cookie và các buổi
đang được dịch, vui lòng đợi..
 
Các ngôn ngữ khác
Hỗ trợ công cụ dịch thuật: Albania, Amharic, Anh, Armenia, Azerbaijan, Ba Lan, Ba Tư, Bantu, Basque, Belarus, Bengal, Bosnia, Bulgaria, Bồ Đào Nha, Catalan, Cebuano, Chichewa, Corsi, Creole (Haiti), Croatia, Do Thái, Estonia, Filipino, Frisia, Gael Scotland, Galicia, George, Gujarat, Hausa, Hawaii, Hindi, Hmong, Hungary, Hy Lạp, Hà Lan, Hà Lan (Nam Phi), Hàn, Iceland, Igbo, Ireland, Java, Kannada, Kazakh, Khmer, Kinyarwanda, Klingon, Kurd, Kyrgyz, Latinh, Latvia, Litva, Luxembourg, Lào, Macedonia, Malagasy, Malayalam, Malta, Maori, Marathi, Myanmar, Mã Lai, Mông Cổ, Na Uy, Nepal, Nga, Nhật, Odia (Oriya), Pashto, Pháp, Phát hiện ngôn ngữ, Phần Lan, Punjab, Quốc tế ngữ, Rumani, Samoa, Serbia, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenia, Somali, Sunda, Swahili, Séc, Tajik, Tamil, Tatar, Telugu, Thái, Thổ Nhĩ Kỳ, Thụy Điển, Tiếng Indonesia, Tiếng Ý, Trung, Trung (Phồn thể), Turkmen, Tây Ban Nha, Ukraina, Urdu, Uyghur, Uzbek, Việt, Xứ Wales, Yiddish, Yoruba, Zulu, Đan Mạch, Đức, Ả Rập, dịch ngôn ngữ.

Copyright ©2025 I Love Translation. All reserved.

E-mail: