summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel <34555296+Flam3rboy@users.noreply.github.com>2021-10-15 15:52:08 +0200
committerGitHub <noreply@github.com>2021-10-15 15:52:08 +0200
commit4d59c898caa3673d7891d8caccb23b0c38c56006 (patch)
treeff010c54cbf0d545ecce1844c6c12315b03ddc41
parent:bug: fix unittests (diff)
parentfeat: add a Router & Route snippet for vscode (diff)
downloadserver-4d59c898caa3673d7891d8caccb23b0c38c56006.tar.xz
Merge pull request #464 from hbjydev/api-snippets
feat: add a Router & Route snippet for 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