@expressots/cli 1.3.3 โ†’ 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,33 +1,110 @@
1
- <p align="center">
2
- <a href="https://expresso-ts.com/" target="blank"><img src="https://github.com/expressots/expressots/blob/main/media/expressots.png" width="120" alt="Expresso TS Logo" /></a>
3
- </p>
1
+ <a name="readme-top"></a>
4
2
 
5
- # Expresso TS
3
+ <!-- PROJECT SHIELDS -->
6
4
 
7
- A Typescript + [Node.js]("https://nodejs.org/en/") lightweight framework for quick building scalable, easy to read and maintain, server-side applications ๐Ÿš€
5
+ [![Contributors][contributors-shield]][contributors-url]
6
+ [![Forks][forks-shield]][forks-url]
7
+ [![Stargazers][stars-shield]][stars-url]
8
+ [![Issues][issues-shield]][issues-url]
9
+ [![MIT License][license-shield]][license-url]
10
+ [![LinkedIn][linkedin-shield]][linkedin-url]
8
11
 
9
- # <h1 align="left">Expresso TS CLI Tool</h1>
12
+ <!-- PROJECT LOGO -->
13
+ <br />
14
+ <div align="center">
15
+ <a href="https://github.com/othneildrew/Best-README-Template">
16
+ <img src="https://github.com/expressots/expressots/blob/main/media/expressots.png" alt="Logo" width="120">
17
+ </a>
10
18
 
11
- ## Description
19
+ <h3 align="center">ExpressoTS Framework</h3>
12
20
 
13
- The ExpressoTS CLI is a command-line interface tool that helps you to create `ExpressoTS` projects, develop, and maintain your applications and resources created. It assists in multiple ways, including creating the project as well as scaffolding services offered by the application such as use cases, controllers, providers and more.
21
+ <p align="center">
22
+ Everything you need to know to build applications with ExpressoTS
23
+ <br />
24
+ <a href="https://doc.expresso-ts.com/"><strong>Explore the docs ยป</strong></a>
25
+ <br />
26
+ <br />
27
+ <a href="https://github.com/expressots/expressots/discussions">Let's discuss</a>
28
+ ยท
29
+ <a href="https://github.com/expressots/expressots/issues">Report Bug</a>
30
+ ยท
31
+ <a href="https://github.com/expressots/expressots/issues">Request Feature</a>
32
+ </p>
33
+ </div>
14
34
 
15
- ## Installation ๐Ÿ’ป
35
+ <!-- TABLE OF CONTENTS -->
36
+ <details>
37
+ <summary>Table of Contents</summary>
38
+ <ol>
39
+ <li><a href="#about-the-project">About The Project</a></li>
40
+ <li><a href="#getting-started">Getting Started</a></li>
41
+ <li><a href="#contributing">Contributing</a></li>
42
+ <li><a href="#support-the-project">Support the project</a></li>
43
+ <li><a href="#license">License</a></li>
44
+ </ol>
45
+ </details>
16
46
 
17
- ```bash
18
- npm i -g @expressots/cli
19
- ```
47
+ <!-- ABOUT THE PROJECT -->
20
48
 
21
- ## Usage
49
+ # About The Project
22
50
 
23
- Learn more in the [official documentation](https://expresso-ts.com/docs/category/cli)
51
+ ExpressoTS is a [Typescript](https://www.typescriptlang.org/) + [Node.js](https://nodejs.org/en/) lightweight framework for quick building scalable, easy to read and maintain, server-side applications ๐ŸŽ
24
52
 
25
- ## Stay in touch
53
+ ## Getting Started
26
54
 
27
- - Author: Daniel Boll | Richard Zampieri
28
- - Website: [https://expresso-ts.com](https://expresso-ts.com)
29
- - Twitch: [@expressots Development](https://www.twitch.tv/richardzampieri)
55
+ - Here is our [Site](https://expresso-ts.com/)
56
+ - You can find our [Documentation here](https://doc.expresso-ts.com/)
57
+ - Checkout our [First Steps documentation](https://doc.expresso-ts.com/docs/overview/first-steps)
58
+ - Our [CLI Documentation](https://doc.expresso-ts.com/docs/cli/overview)
59
+
60
+ ## Contributing
61
+
62
+ Welcome to the ExpressoTS community, a place bustling with innovative minds just like yours. We're absolutely thrilled to have you here!
63
+ ExpressoTS is more than just a TypeScript framework; it's a collective effort by developers who are passionate about creating a more efficient, secure, and robust web ecosystem. We firmly believe that the best ideas come from a diversity of perspectives, backgrounds, and skills.
64
+
65
+ Why Contribute to Documentation?
66
+
67
+ - **Share Knowledge**: If you've figured out something cool, why keep it to yourself?
68
+ - **Build Your Portfolio**: Contributing to an open-source project like ExpressoTS is a great way to showcase your skills.
69
+ - **Join a Network**: Get to know a community of like-minded developers.
70
+ - **Improve the Product**: Help us fill in the gaps, correct errors, or make complex topics easier to understand.
71
+
72
+ Ready to contribute?
73
+
74
+ - [Contributing Guidelines](https://github.com/expressots/expressots/blob/main/CONTRIBUTING.md)
75
+ - [How to Contribute](https://github.com/expressots/expressots/blob/main/CONTRIBUTING_HOWTO.md)
76
+ - [Coding Guidelines](https://github.com/rsaz/TypescriptCodingGuidelines)
77
+
78
+ ## Support the project
79
+
80
+ ExpressoTS is an independent open source project with ongoing development made possible thanks to your support. If you'd like to help, please consider:
81
+
82
+ - Become a **[sponsor on GitHub](https://github.com/sponsors/expressots)**
83
+ - Follow the **[organization](https://github.com/expressots)** on GitHub and Star โญ the project
84
+ - Subscribe to the Twitch channel: **[Richard Zampieri](https://www.twitch.tv/richardzampieri)**
85
+ - Join our **[Discord](https://discord.com/invite/PyPJfGK)**
86
+ - Contribute submitting **[issues and pull requests](https://github.com/expressots/expressots/issues)**
87
+ - Share the project with your friends and colleagues
30
88
 
31
89
  ## License
32
90
 
33
- ExpressoTS is [MIT Licensed](https://github.com/expressots/expressots-cli/blob/main/LICENSE.md)
91
+ Distributed under the MIT License. See [`LICENSE.txt`](https://github.com/expressots/expressots/blob/main/LICENSE) for more information.
92
+
93
+ <p align="right">(<a href="#readme-top">back to top</a>)</p>
94
+
95
+ <!-- MARKDOWN LINKS & IMAGES -->
96
+ <!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
97
+
98
+ [contributors-shield]: https://img.shields.io/github/contributors/expressots/expressots-cli?style=for-the-badge
99
+ [contributors-url]: https://github.com/expressots/expressots-cli/graphs/contributors
100
+ [forks-shield]: https://img.shields.io/github/forks/expressots/expressots-cli?style=for-the-badge
101
+ [forks-url]: https://github.com/expressots/expressots-cli/forks
102
+ [stars-shield]: https://img.shields.io/github/stars/expressots/expressots-cli?style=for-the-badge
103
+ [stars-url]: https://github.com/expressots/expressots-cli/stargazers
104
+ [issues-shield]: https://img.shields.io/github/issues/expressots/expressots-cli?style=for-the-badge
105
+ [issues-url]: https://github.com/expressots/expressots-cli/issues
106
+ [license-shield]: https://img.shields.io/github/license/expressots/expressots-cli?style=for-the-badge
107
+ [license-url]: https://github.com/expressots/expressots-cli/blob/main/LICENSE
108
+ [linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
109
+ [linkedin-url]: https://www.linkedin.com/company/expresso-ts/
110
+ [product-screenshot]: images/screenshot.png
@@ -6,4 +6,4 @@ const appContainer = new AppContainer();
6
6
 
7
7
  const container = appContainer.create([// Add your modules here, UserModule, UserModule, UserModule]);
8
8
 
9
- export { container };*/
9
+ export { container };*/
package/bin/cli.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export declare const CLI_VERSION = "1.3.0";
2
+ export declare const CLI_VERSION = "1.3.4";
package/bin/cli.js CHANGED
@@ -10,7 +10,7 @@ const helpers_1 = require("yargs/helpers");
10
10
  const generate_1 = require("./generate");
11
11
  const info_1 = require("./info");
12
12
  const new_1 = require("./new");
13
- exports.CLI_VERSION = "1.3.0";
13
+ exports.CLI_VERSION = "1.3.4";
14
14
  console.log(`\n[๐ŸŽ Expressots]\n`);
15
15
  (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
16
16
  .scriptName("expressots")
@@ -16,6 +16,8 @@ const coerceSchematicAliases = (arg) => {
16
16
  return "provider";
17
17
  case "e":
18
18
  return "entity";
19
+ case "m":
20
+ return "module";
19
21
  default:
20
22
  return arg;
21
23
  }
@@ -34,6 +36,7 @@ const generateProject = () => {
34
36
  "service",
35
37
  "provider",
36
38
  "entity",
39
+ "module",
37
40
  ],
38
41
  describe: "The schematic to generate",
39
42
  type: "string",
@@ -45,13 +48,7 @@ const generateProject = () => {
45
48
  alias: "d",
46
49
  });
47
50
  yargs.positional("method", {
48
- choices: [
49
- "get",
50
- "post",
51
- "put",
52
- "patch",
53
- "delete",
54
- ],
51
+ choices: ["get", "post", "put", "patch", "delete"],
55
52
  describe: "HTTP method",
56
53
  type: "string",
57
54
  alias: "m",
@@ -46,7 +46,7 @@ const verify_file_exists_1 = require("../utils/verify-file-exists");
46
46
  const add_module_to_container_1 = require("../utils/add-module-to-container");
47
47
  const cli_ui_1 = require("../utils/cli-ui");
48
48
  function getFileNameWithoutExtension(filePath) {
49
- return filePath.split('.')[0];
49
+ return filePath.split(".")[0];
50
50
  }
51
51
  const createTemplate = async ({ schematic, path: target, method, }) => {
52
52
  var _a, e_1, _b, _c;
@@ -69,18 +69,25 @@ const createTemplate = async ({ schematic, path: target, method, }) => {
69
69
  if (schematic !== "service") {
70
70
  // add to guarantee that the routing will always be the last part of the path
71
71
  let routeSchema = "";
72
- if (target.includes("/") || target.includes("\\") || target.includes("//")) {
72
+ if (target.includes("/") ||
73
+ target.includes("\\") ||
74
+ target.includes("//")) {
73
75
  routeSchema = path.split("/").pop();
74
76
  }
75
77
  else {
76
- routeSchema = path.replace(/\/$/, '');
78
+ routeSchema = path.replace(/\/$/, "");
79
+ }
80
+ let templateBasedSchematic = schematic;
81
+ if (schematic === "module") {
82
+ templateBasedSchematic = "module-default";
77
83
  }
78
84
  writeTemplate({
79
85
  outputPath: `${usecaseDir}/${path}/${file}`,
80
86
  template: {
81
- path: `./templates/${schematic}.tpl`,
87
+ path: `./templates/${templateBasedSchematic}.tpl`,
82
88
  data: {
83
89
  className,
90
+ moduleName: className,
84
91
  route: routeSchema,
85
92
  construct: (0, boost_ts_1.anyCaseToKebabCase)(className),
86
93
  method: getHttpMethod(method),
@@ -100,7 +107,8 @@ const createTemplate = async ({ schematic, path: target, method, }) => {
100
107
  console.log(" ", chalk_1.default.greenBright(`[${currentSchematic}]`.padEnd(14)), chalk_1.default.bold.white(`${schematicFile} created! โœ”๏ธ`));
101
108
  let templateBasedMethod = "";
102
109
  if (method) {
103
- if (resource === "controller-service" || resource === "controller") {
110
+ if (resource === "controller-service" ||
111
+ resource === "controller") {
104
112
  if (method === "get")
105
113
  templateBasedMethod = `./templates/${resource}.tpl`;
106
114
  else
@@ -124,11 +132,13 @@ const createTemplate = async ({ schematic, path: target, method, }) => {
124
132
  }
125
133
  // add to guarantee that the routing will always be the last part of the path
126
134
  let routeSchema = "";
127
- if (target.includes("/") || target.includes("\\") || target.includes("//")) {
135
+ if (target.includes("/") ||
136
+ target.includes("\\") ||
137
+ target.includes("//")) {
128
138
  routeSchema = path.split("/").pop();
129
139
  }
130
140
  else {
131
- routeSchema = path.replace(/\/$/, '');
141
+ routeSchema = path.replace(/\/$/, "");
132
142
  }
133
143
  writeTemplate({
134
144
  outputPath: `${usecaseDir}/${path}/${schematicFile}`,
@@ -162,7 +172,9 @@ const createTemplate = async ({ schematic, path: target, method, }) => {
162
172
  if (["controller", "service"].includes(schematic)) {
163
173
  let moduleExist = false;
164
174
  let moduleOutPath = "";
165
- if (target.includes("/") || target.includes("\\") || target.includes("//")) {
175
+ if (target.includes("/") ||
176
+ target.includes("\\") ||
177
+ target.includes("//")) {
166
178
  if (modulePath === "") {
167
179
  moduleExist = (0, fs_1.existsSync)(`${usecaseDir}/${moduleName}.module.ts`);
168
180
  moduleOutPath = `${usecaseDir}/${moduleName}.module.ts`;
@@ -184,22 +196,26 @@ const createTemplate = async ({ schematic, path: target, method, }) => {
184
196
  }
185
197
  }
186
198
  let controllerPath = "./";
187
- const pathCount = (path.split("/")).length;
199
+ const pathCount = path.split("/").length;
188
200
  if (path === "") {
189
- controllerPath += `${file.slice(0, file.lastIndexOf('.'))}`;
201
+ controllerPath += `${file.slice(0, file.lastIndexOf("."))}`;
190
202
  }
191
203
  else if (pathCount === 1) {
192
- controllerPath += `${path}/${file.slice(0, file.lastIndexOf('.'))}`;
204
+ controllerPath += `${path}/${file.slice(0, file.lastIndexOf("."))}`;
193
205
  }
194
206
  else if (pathCount === 2) {
195
- controllerPath += `${path.split("/")[1]}/${file.slice(0, file.lastIndexOf('.'))}`;
207
+ controllerPath += `${path.split("/")[1]}/${file.slice(0, file.lastIndexOf("."))}`;
196
208
  }
197
209
  else {
198
- const segments = path.split("/").filter((segment) => segment !== "");
199
- controllerPath += `${segments[segments.length - 1]}/${file.slice(0, file.lastIndexOf('.'))}`;
210
+ const segments = path
211
+ .split("/")
212
+ .filter((segment) => segment !== "");
213
+ controllerPath += `${segments[segments.length - 1]}/${file.slice(0, file.lastIndexOf("."))}`;
200
214
  }
201
215
  if (moduleExist) {
202
- if (target.includes("/") || target.includes("\\") || target.includes("//")) {
216
+ if (target.includes("/") ||
217
+ target.includes("\\") ||
218
+ target.includes("//")) {
203
219
  await (0, add_controller_to_module_1.addControllerToModule)(`${usecaseDir}/${modulePath}/${moduleName}.module.ts`, `${className}Controller`, controllerPath);
204
220
  }
205
221
  else {
@@ -219,12 +235,14 @@ const createTemplate = async ({ schematic, path: target, method, }) => {
219
235
  data: {
220
236
  moduleName: moduleName[0].toUpperCase() + moduleName.slice(1),
221
237
  className,
222
- path: controllerPath
238
+ path: controllerPath,
223
239
  },
224
240
  },
225
241
  });
226
242
  console.log(" ", chalk_1.default.greenBright(`[module]`.padEnd(14)), chalk_1.default.bold.white(`${moduleName}.module created! โœ”๏ธ`));
227
- if (target.includes("/") || target.includes("\\") || target.includes("//")) {
243
+ if (target.includes("/") ||
244
+ target.includes("\\") ||
245
+ target.includes("//")) {
228
246
  await (0, add_module_to_container_1.addModuleToContainer)(moduleName, modulePath, path);
229
247
  }
230
248
  else {
@@ -242,30 +260,41 @@ const createTemplate = async ({ schematic, path: target, method, }) => {
242
260
  };
243
261
  exports.createTemplate = createTemplate;
244
262
  const splitTarget = async ({ target, schematic, }) => {
245
- const pathContent = target.split("/").filter((item) => item !== "");
263
+ const pathContent = target
264
+ .split("/")
265
+ .filter((item) => item !== "");
246
266
  const endsWithSlash = target.endsWith("/");
247
267
  let path = "";
248
268
  let fileName = "";
249
269
  let module = "";
250
270
  let modulePath = "";
251
- if (target.includes("/") || target.includes("\\") || target.includes("//")) {
271
+ if (target.includes("/") ||
272
+ target.includes("\\") ||
273
+ target.includes("//")) {
252
274
  //pathContent = target.split("/").filter((item) => item !== "");
253
275
  if (schematic === "service")
254
276
  schematic = "controller";
255
- if (schematic === "service" || schematic === "controller" && pathContent.length > 4) {
277
+ if (schematic === "service" ||
278
+ (schematic === "controller" && pathContent.length > 4)) {
256
279
  (0, cli_ui_1.printError)("Max path depth is 4.", pathContent.join("/"));
257
280
  process.exit(1);
258
281
  }
259
282
  if (endsWithSlash) {
260
283
  fileName = pathContent[pathContent.length - 1];
261
284
  path = pathContent.join("/");
262
- module = (pathContent.length == 1) ? pathContent[pathContent.length - 1] : pathContent[pathContent.length - 2];
285
+ module =
286
+ pathContent.length == 1
287
+ ? pathContent[pathContent.length - 1]
288
+ : pathContent[pathContent.length - 2];
263
289
  modulePath = pathContent.slice(0, -1).join("/");
264
290
  }
265
291
  else {
266
292
  fileName = pathContent[pathContent.length - 1];
267
293
  path = pathContent.slice(0, -1).join("/");
268
- module = (pathContent.length == 2) ? pathContent[pathContent.length - 2] : pathContent[pathContent.length - 3];
294
+ module =
295
+ pathContent.length == 2
296
+ ? pathContent[pathContent.length - 2]
297
+ : pathContent[pathContent.length - 3];
269
298
  modulePath = pathContent.slice(0, -2).join("/");
270
299
  }
271
300
  return {
@@ -273,7 +302,7 @@ const splitTarget = async ({ target, schematic, }) => {
273
302
  file: `${await getNameWithScaffoldPattern(fileName)}.${schematic}.ts`,
274
303
  className: (0, boost_ts_1.anyCaseToPascalCase)(fileName),
275
304
  moduleName: module,
276
- modulePath
305
+ modulePath,
277
306
  };
278
307
  }
279
308
  else {
@@ -293,7 +322,7 @@ const splitTarget = async ({ target, schematic, }) => {
293
322
  file: `${await getNameWithScaffoldPattern(name)}.${schematic}.ts`,
294
323
  className: (0, boost_ts_1.anyCaseToPascalCase)(name),
295
324
  moduleName: wordName,
296
- modulePath: (pathContent[0].split("-")[1])
325
+ modulePath: pathContent[0].split("-")[1],
297
326
  };
298
327
  }
299
328
  // 3. Return the base case
@@ -302,22 +331,22 @@ const splitTarget = async ({ target, schematic, }) => {
302
331
  file: `${await getNameWithScaffoldPattern(name)}.${schematic}.ts`,
303
332
  className: (0, boost_ts_1.anyCaseToPascalCase)(name),
304
333
  moduleName: name,
305
- modulePath: ""
334
+ modulePath: "",
306
335
  };
307
336
  }
308
337
  };
309
338
  const getHttpMethod = (method) => {
310
339
  switch (method) {
311
340
  case "put":
312
- return "httpPut";
341
+ return "Put";
313
342
  case "post":
314
- return "httpPost";
343
+ return "Post";
315
344
  case "patch":
316
- return "httpPatch";
345
+ return "Patch";
317
346
  case "delete":
318
- return "httpDelete";
347
+ return "Delete";
319
348
  default:
320
- return "httpGet";
349
+ return "Get";
321
350
  }
322
351
  };
323
352
  const writeTemplate = ({ outputPath, template: { path, data }, }) => {
@@ -1,24 +1,21 @@
1
1
  import { BaseController, StatusCode } from "@expressots/core";
2
- import { controller, {{method}}, requestParam, response } from "inversify-express-utils";
2
+ import { controller, {{method}}, param, response } from "@expressots/adapter-express";
3
3
  import { Response } from "express";
4
4
  import { {{className}}UseCase } from "./{{fileName}}.usecase";
5
5
  import { I{{className}}RequestDTO, I{{className}}ResponseDTO } from "./{{fileName}}.dto";
6
6
 
7
7
  @controller("/{{{route}}}")
8
- class {{className}}Controller extends BaseController {
9
-
10
- constructor(private {{useCase}}UseCase: {{className}}UseCase) {
11
- super("{{construct}}-controller")
8
+ export class {{className}}Controller extends BaseController {
9
+ constructor(private {{useCase}}UseCase: {{className}}UseCase) {
10
+ super();
12
11
  }
13
12
 
14
- @{{method}}("/:id")
15
- execute(@requestParam() payload: I{{className}}RequestDTO, @response() res: Response): I{{className}}ResponseDTO {
16
- return this.callUseCase(
17
- this.{{useCase}}UseCase.execute(payload),
13
+ @{{method}}("/:id")
14
+ execute(@param("id") id: string, @response() res: Response): I{{className}}ResponseDTO {
15
+ return this.callUseCase(
16
+ this.{{useCase}}UseCase.execute(id),
18
17
  res,
19
18
  StatusCode.OK,
20
- );
21
- }
19
+ );
20
+ }
22
21
  }
23
-
24
- export { {{className}}Controller };
@@ -1,28 +1,24 @@
1
1
  import { BaseController, StatusCode } from "@expressots/core";
2
- import { controller, {{method}}, requestBody, requestParam, response } from "inversify-express-utils";
2
+ import { controller, {{method}}, body, param, response } from "@expressots/adapter-express";
3
3
  import { Response } from "express";
4
4
  import { {{className}}UseCase } from "./{{fileName}}.usecase";
5
5
  import { I{{className}}RequestDTO, I{{className}}ResponseDTO } from "./{{fileName}}.dto";
6
6
 
7
7
  @controller("/{{{route}}}")
8
- class {{className}}Controller extends BaseController {
9
-
10
- constructor(private {{useCase}}UseCase: {{className}}UseCase) {
11
- super("{{construct}}-controller")
8
+ export class {{className}}Controller extends BaseController {
9
+ constructor(private {{useCase}}UseCase: {{className}}UseCase) {
10
+ super();
12
11
  }
13
12
 
14
- @{{method}}("/:id")
15
- execute(
16
- @requestParam("id") id: string,
17
- @requestBody() payload: I{{className}}RequestDTO,
18
- @response() res: Response,
19
- ): I{{className}}ResponseDTO {
20
- return this.callUseCase(
21
- this.{{useCase}}UseCase.execute(id, payload),
13
+ @{{method}}("/")
14
+ execute(
15
+ @body() payload: I{{className}}RequestDTO,
16
+ @response() res: Response,
17
+ ): I{{className}}ResponseDTO {
18
+ return this.callUseCase(
19
+ this.{{useCase}}UseCase.execute(payload),
22
20
  res,
23
21
  StatusCode.OK,
24
- );
25
- }
22
+ );
23
+ }
26
24
  }
27
-
28
- export { {{className}}Controller };
@@ -1,24 +1,21 @@
1
1
  import { BaseController, StatusCode } from "@expressots/core";
2
- import { controller, {{method}}, requestBody, response } from "inversify-express-utils";
2
+ import { controller, {{method}}, body, response } from "@expressots/adapter-express";
3
3
  import { Response } from "express";
4
4
  import { {{className}}UseCase } from "./{{fileName}}.usecase";
5
5
  import { I{{className}}RequestDTO, I{{className}}ResponseDTO } from "./{{fileName}}.dto";
6
6
 
7
7
  @controller("/{{{route}}}")
8
- class {{className}}Controller extends BaseController {
9
-
10
- constructor(private {{useCase}}UseCase: {{className}}UseCase) {
11
- super("{{construct}}-controller")
8
+ export class {{className}}Controller extends BaseController {
9
+ constructor(private {{useCase}}UseCase: {{className}}UseCase) {
10
+ super();
12
11
  }
13
12
 
14
- @{{method}}("/")
15
- execute(@requestBody() payload: I{{className}}RequestDTO, @response() res: Response): I{{className}}ResponseDTO {
16
- return this.callUseCase(
13
+ @{{method}}("/")
14
+ execute(@body() payload: I{{className}}RequestDTO, @response() res: Response): I{{className}}ResponseDTO {
15
+ return this.callUseCase(
17
16
  this.{{useCase}}UseCase.execute(payload),
18
17
  res,
19
18
  StatusCode.Created,
20
- );
21
- }
19
+ );
20
+ }
22
21
  }
23
-
24
- export { {{className}}Controller };
@@ -1,28 +1,24 @@
1
1
  import { BaseController, StatusCode } from "@expressots/core";
2
- import { controller, {{method}}, requestBody, requestParam, response } from "inversify-express-utils";
2
+ import { controller, {{method}}, body, param, response } from "@expressots/adapter-express";
3
3
  import { Response } from "express";
4
4
  import { {{className}}UseCase } from "./{{fileName}}.usecase";
5
5
  import { I{{className}}RequestDTO, I{{className}}ResponseDTO } from "./{{fileName}}.dto";
6
6
 
7
7
  @controller("/{{{route}}}")
8
- class {{className}}Controller extends BaseController {
9
-
10
- constructor(private {{useCase}}UseCase: {{className}}UseCase) {
11
- super("{{construct}}-controller")
8
+ export class {{className}}Controller extends BaseController {
9
+ constructor(private {{useCase}}UseCase: {{className}}UseCase) {
10
+ super();
12
11
  }
13
12
 
14
- @{{method}}("/:id")
15
- execute(
16
- @requestParam("id") id: string,
17
- @requestBody() payload: I{{className}}RequestDTO,
18
- @response() res: Response,
19
- ): I{{className}}ResponseDTO {
20
- return this.callUseCase(
21
- this.{{useCase}}UseCase.execute(id, payload),
13
+ @{{method}}("/")
14
+ execute(
15
+ @body() payload: I{{className}}RequestDTO,
16
+ @response() res: Response,
17
+ ): I{{className}}ResponseDTO {
18
+ return this.callUseCase(
19
+ this.{{useCase}}UseCase.execute(payload),
22
20
  res,
23
21
  StatusCode.OK,
24
- );
25
- }
22
+ );
23
+ }
26
24
  }
27
-
28
- export { {{className}}Controller };
@@ -1,24 +1,21 @@
1
1
  import { BaseController, StatusCode } from "@expressots/core";
2
- import { controller, {{method}}, response } from "inversify-express-utils";
2
+ import { controller, {{method}}, response } from "@expressots/adapter-express";
3
3
  import { Response } from "express";
4
4
  import { {{className}}UseCase } from "./{{fileName}}.usecase";
5
5
  import { I{{className}}ResponseDTO } from "./{{fileName}}.dto";
6
6
 
7
7
  @controller("/{{{route}}}")
8
- class {{className}}Controller extends BaseController {
9
-
10
- constructor(private {{useCase}}UseCase: {{className}}UseCase) {
11
- super("{{construct}}-controller")
8
+ export class {{className}}Controller extends BaseController {
9
+ constructor(private {{useCase}}UseCase: {{className}}UseCase) {
10
+ super();
12
11
  }
13
12
 
14
- @{{method}}("/")
15
- execute(@response() res: Response): I{{className}}ResponseDTO {
16
- return this.callUseCase(
13
+ @{{method}}("/")
14
+ execute(@response() res: Response): I{{className}}ResponseDTO {
15
+ return this.callUseCase(
17
16
  this.{{useCase}}UseCase.execute(),
18
17
  res,
19
18
  StatusCode.OK,
20
- );
21
- }
19
+ );
20
+ }
22
21
  }
23
-
24
- export { {{className}}Controller };
@@ -1,18 +1,10 @@
1
1
  import { BaseController } from "@expressots/core";
2
- import { controller, {{method}}, response } from "inversify-express-utils";
3
- import { Response } from "express";
2
+ import { controller, {{method}} } from "@expressots/adapter-express";
4
3
 
5
4
  @controller("/{{{route}}}")
6
- class {{className}}Controller extends BaseController {
7
-
8
- constructor() {
9
- super("{{construct}}-controller")
10
- }
11
-
12
- @{{method}}("/")
13
- execute(@response() res: Response) {
14
- return res.send("Hello Expresso TS");
15
- }
5
+ export class {{className}}Controller extends BaseController {
6
+ @{{method}}("/")
7
+ execute() {
8
+ return "Ok";
9
+ }
16
10
  }
17
-
18
- export { {{className}}Controller };
@@ -1,7 +1,7 @@
1
- interface I{{className}}RequestDTO {
1
+ export interface I{{className}}RequestDTO {
2
2
  id: string;
3
3
  }
4
4
 
5
- interface I{{className}}ResponseDTO { }
5
+ export interface I{{className}}ResponseDTO { }
6
+
6
7
 
7
- export { I{{className}}RequestDTO, I{{className}}ResponseDTO };
@@ -1,5 +1,3 @@
1
- interface I{{className}}RequestDTO { }
1
+ export interface I{{className}}RequestDTO {}
2
2
 
3
- interface I{{className}}ResponseDTO { }
4
-
5
- export { I{{className}}RequestDTO, I{{className}}ResponseDTO };
3
+ export interface I{{className}}ResponseDTO {}