This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
api/generators/service/index.js

46 lines
1.0 KiB
JavaScript
Raw Normal View History

2021-10-24 04:18:18 +02:00
/** @type {import('node-plop').PlopGeneratorConfig} */
export const serviceGenerator = {
description: "REST API endpoint",
2021-10-24 04:18:18 +02:00
prompts: [
{
type: "input",
name: "url",
message: "url",
2021-10-24 04:18:18 +02:00
},
{
type: "list",
name: "httpMethod",
message: "httpMethod",
choices: ["GET", "POST", "PUT", "DELETE"],
2021-10-24 04:18:18 +02:00
},
{
type: "input",
name: "description",
message: "description",
2021-10-24 04:18:18 +02:00
},
{
type: "list",
name: "tag",
message: "tag",
choices: ["users", "oauth2", "guilds", "channels", "messages", "members"],
2021-10-24 04:18:18 +02:00
},
{
type: "confirm",
name: "shouldBeAuthenticated",
message: "shouldBeAuthenticated",
},
2021-10-24 04:18:18 +02:00
],
actions: [
{
type: "add",
path: "src/services/{{url}}/{{lowerCase httpMethod}}.ts",
templateFile: "generators/service/service.ts.hbs",
2021-10-24 04:18:18 +02:00
},
{
type: "add",
path: "src/services/{{url}}/__test__/{{lowerCase httpMethod}}.test.ts",
templateFile: "generators/service/service.test.ts.hbs",
},
],
2021-10-24 04:18:18 +02:00
}