This repository has been archived on 2024-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
wikipedia-game-solver/.vscode/adonis.code-snippets

37 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

{
"Adonis Controller and Route": {
"scope": "typescript",
"prefix": "apic",
"body": [
"import { throttle } from \"#start/limiter.ts\"",
"import type { HttpContext } from \"@adonisjs/core/http\"",
"import router from \"@adonisjs/core/services/router\"",
"import vine from \"@vinejs/vine\"",
"",
"export const ${1:controller_name}_validator = vine.compile(",
" vine.object({})",
")",
"",
"export default class ${1:controller_name} {",
" public async handle(context: HttpContext): Promise<{",
" __response: unknown",
" __status: 200",
" }> {",
" const payload = await context.request.validateUsing(${1:controller_name}_validator)",
" return context.response.ok(payload)",
" }",
"}",
"",
"router",
" .get(\"${2:/router-path}\", [${1:controller_name}])",
" .use(throttle)",
" .openapi({",
" description: \"Description.\",",
" tags: [\"tag\"],",
" })",
"",
],
"description": "Adonis Controller and Route",
},
}