本文整理匯總了TypeScript中express.Response.send方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Response.send方法的具體用法?TypeScript Response.send怎麽用?TypeScript Response.send使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類express.Response
的用法示例。
在下文中一共展示了Response.send方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
export default function(req: Request, res: Response) {
res.send('Hello world')
}
示例2:
app.use(function (err: any, req: Request, res: Response, next: NextFunction) {
res.type("text/plain");
res.status(500);
res.send("500 - Server Error");
});
示例3:
app.use((err: any, req: Request, res: Response, next: Function) => {
LOGGER.error(`Server Error: ${err.message}`);
LOGGER.error(err.stack);
res.status(err.status || 500);
res.send(errorLayout({ version: VERSION, title: 'Error' }, err.message, err));
});
示例4:
.then((rawContent) => {
const scripts = HAS_WW ? WORKER_SCRIPTS : BROWSER_SCRIPTS;
const content = rawContent.replace('</body>', scripts + '</body>');
return res.send(content);
})
示例5: function
dbo.collection("users").update({"onyen": onyenToUpdate}, {"$set": {"points": points}}, function(err, res2) {
if (err) throw err;
var response = JSON.stringify(res2);
res.send(response);
});
示例6:
router.get("/admin", (req: Request, res: Response, next: NextFunction) => {
res.send("You either do not have permission to access this page, or you are trying to access it directly. If you are an admin, please authenticate and try again.")
})
示例7:
app.use((err: any, req: Request, res: Response, next: Function) => {
res.status(err.status || 500);
res.send(errorLayout({ version: VERSION, title: 'Error' }, err.message, err));
});