本文整理汇总了TypeScript中bap-node-microframework/decorators.Get函数的典型用法代码示例。如果您正苦于以下问题:TypeScript Get函数的具体用法?TypeScript Get怎么用?TypeScript Get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Get函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: helloWithoutName
@Get('/hello', { authenticated: false })
helloWithoutName(req, res) {
res.json({
hello: "world",
next_step: "Go to http://localhost:3000/hello/yourName for a more personalized greeting!"
});
}
示例2: helloWithtName
@Get('/hello/:name', { authenticated: false })
helloWithtName(req, res) {
res.json({
hello: req.params.name,
next_step: "Nice! Go to http://localhost:3000/friends for your friends list!",
if_you_feel_alone: "curl -H \"Content-Type: application/json\" -X POST -d '{\"name\": \"mark\", \"email\": \"mark@mark.com\" }' http://localhost:3000/friends",
if_your_friend_has_inexplicably_changed_name: "curl -H \"Content-Type: application/json\" -X PUT -d '{\"name\": \"john\", \"email\": \"john@john.com\" }' http://localhost:3000/friends/mark",
if_your_friend_has_stolen_your_girlfriend_or_boyfriend: "curl -H \"Content-Type: application/json\" -X DELETE http://localhost:3000/friends/john",
});
}
示例3: hoomePage
@Get('/', { authenticated: false })
hoomePage(req, res) {
res.send("It works! Go to <a href='http://localhost:3000/hello'>http://localhost:3000/hello</a> for a nice greeting!");
}
示例4: getAll
@Get("/ping", { authenticated: false })
getAll(req, res) {
res.json({
ping: 'pong'
});
}
示例5: getAllFriends
@Get('/friends', { authenticated: false })
getAllFriends(req, res) {
super.cget(res, "Friend");
}