mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 20:52:42 +01:00
Merge pull request #464 from hbjydev/api-snippets
feat: add a Router & Route snippet for vscode
This commit is contained in:
commit
4d59c898ca
29
api/.vscode/api-snippets.code-snippets
vendored
Normal file
29
api/.vscode/api-snippets.code-snippets
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"API Router": {
|
||||
"scope": "javascript,typescript",
|
||||
"prefix": "router",
|
||||
"body": [
|
||||
"import { Router, Response, Request } from \"express\";",
|
||||
"import { route } from \"@fosscord/api\";",
|
||||
"",
|
||||
"const router = Router();",
|
||||
"",
|
||||
"router.get(\"/\", route({}), (req: Request, res: Response) => {",
|
||||
"\tres.json({});",
|
||||
"});",
|
||||
"",
|
||||
"export default router;"
|
||||
],
|
||||
"description": "A basic API router setup for a blank route."
|
||||
},
|
||||
"Route": {
|
||||
"scope": "typescript",
|
||||
"prefix": "route",
|
||||
"body": [
|
||||
"router.get(\"$1\", route({}), (req: Request, res: Response) => {",
|
||||
"\t$2",
|
||||
"});"
|
||||
],
|
||||
"description": "An API endpoint"
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue
Block a user