本文整理汇总了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));
});