summary refs log tree commit diff
path: root/api/.vscode
diff options
context:
space:
mode:
authorHayden Young <hi@hbjy.dev>2021-10-15 13:11:35 +0000
committerGitHub <noreply@github.com>2021-10-15 13:11:35 +0000
commitf474364f33c32014b798c2901cdfa8f0b2a31c0e (patch)
tree14edaaa9e6c75e1fbd9dfc01eebd8fd9dfd8491f /api/.vscode
parent:bug: fix unittests (diff)
downloadserver-f474364f33c32014b798c2901cdfa8f0b2a31c0e.tar.xz
feat: add a Router & Route snippet for vscode
Diffstat (limited to 'api/.vscode')
-rw-r--r--api/.vscode/api-snippets.code-snippets29
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