diff options
author | Hayden Young <hi@hbjy.dev> | 2021-10-15 13:11:35 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-15 13:11:35 +0000 |
commit | f474364f33c32014b798c2901cdfa8f0b2a31c0e (patch) | |
tree | 14edaaa9e6c75e1fbd9dfc01eebd8fd9dfd8491f /api/.vscode | |
parent | :bug: fix unittests (diff) | |
download | server-f474364f33c32014b798c2901cdfa8f0b2a31c0e.tar.xz |
feat: add a Router & Route snippet for vscode
Diffstat (limited to 'api/.vscode')
-rw-r--r-- | api/.vscode/api-snippets.code-snippets | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/api/.vscode/api-snippets.code-snippets b/api/.vscode/api-snippets.code-snippets new file mode 100644 index 00000000..17bde62f --- /dev/null +++ b/api/.vscode/api-snippets.code-snippets @@ -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" + }, +} \ No newline at end of file |