@expressots/core 1.0.1 → 1.1.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 +33 -122
- package/lib/CHANGELOG.md +101 -0
- package/lib/README.md +64 -0
- package/lib/cjs/application/app-container.js +28 -0
- package/{application → lib/cjs/application}/application.js +17 -6
- package/lib/cjs/console/console.js +77 -0
- package/{container-module → lib/cjs/container-module}/container-module.js +11 -3
- package/lib/cjs/controller/base-controller.js +56 -0
- package/{environment → lib/cjs/environment}/env-validator.js +13 -5
- package/lib/cjs/error/application-error.js +26 -0
- package/lib/cjs/error/report.js +20 -0
- package/lib/cjs/index.js +23 -0
- package/{logger → lib/cjs/logger}/general-logger.js +15 -4
- package/{application → lib/cjs/types/application}/app-container.d.ts +1 -0
- package/lib/cjs/types/application/app-container.d.ts.map +1 -0
- package/{application → lib/cjs/types/application}/application.d.ts +1 -0
- package/lib/cjs/types/application/application.d.ts.map +1 -0
- package/lib/cjs/types/application/index.d.ts +3 -0
- package/lib/cjs/types/application/index.d.ts.map +1 -0
- package/{console → lib/cjs/types/console}/console.d.ts +1 -0
- package/lib/cjs/types/console/console.d.ts.map +1 -0
- package/{console → lib/cjs/types/console}/index.d.ts +1 -0
- package/lib/cjs/types/console/index.d.ts.map +1 -0
- package/{container-module → lib/cjs/types/container-module}/container-module.d.ts +1 -0
- package/lib/cjs/types/container-module/container-module.d.ts.map +1 -0
- package/lib/cjs/types/container-module/index.d.ts +2 -0
- package/lib/cjs/types/container-module/index.d.ts.map +1 -0
- package/{controller → lib/cjs/types/controller}/base-controller.d.ts +1 -0
- package/lib/cjs/types/controller/base-controller.d.ts.map +1 -0
- package/lib/cjs/types/controller/index.d.ts +2 -0
- package/lib/cjs/types/controller/index.d.ts.map +1 -0
- package/{environment → lib/cjs/types/environment}/env-validator.d.ts +1 -0
- package/lib/cjs/types/environment/env-validator.d.ts.map +1 -0
- package/lib/cjs/types/environment/index.d.ts +2 -0
- package/lib/cjs/types/environment/index.d.ts.map +1 -0
- package/{error → lib/cjs/types/error}/application-error.d.ts +1 -0
- package/lib/cjs/types/error/application-error.d.ts.map +1 -0
- package/{error → lib/cjs/types/error}/error-handler-middleware.d.ts +1 -0
- package/lib/cjs/types/error/error-handler-middleware.d.ts.map +1 -0
- package/lib/cjs/types/error/index.d.ts +4 -0
- package/lib/cjs/types/error/index.d.ts.map +1 -0
- package/{error → lib/cjs/types/error}/report.d.ts +1 -0
- package/lib/cjs/types/error/report.d.ts.map +1 -0
- package/{error → lib/cjs/types/error}/status-code.d.ts +1 -0
- package/lib/cjs/types/error/status-code.d.ts.map +1 -0
- package/lib/cjs/types/index.d.ts +8 -0
- package/lib/cjs/types/index.d.ts.map +1 -0
- package/{logger → lib/cjs/types/logger}/general-logger.d.ts +2 -1
- package/lib/cjs/types/logger/general-logger.d.ts.map +1 -0
- package/lib/cjs/types/logger/index.d.ts +2 -0
- package/lib/cjs/types/logger/index.d.ts.map +1 -0
- package/lib/esm/application/app-container.js +26 -0
- package/lib/esm/application/application.js +68 -0
- package/{console → lib/esm/console}/console.js +17 -15
- package/lib/esm/console/index.js +1 -0
- package/lib/esm/container-module/container-module.js +39 -0
- package/lib/esm/controller/base-controller.js +43 -0
- package/lib/esm/environment/env-validator.js +65 -0
- package/lib/esm/error/application-error.js +25 -0
- package/lib/esm/error/error-handler-middleware.js +7 -0
- package/lib/esm/error/report.js +17 -0
- package/lib/esm/error/status-code.js +80 -0
- package/lib/esm/logger/general-logger.js +96 -0
- package/lib/esm/types/application/app-container.d.ts +8 -0
- package/lib/esm/types/application/app-container.d.ts.map +1 -0
- package/lib/esm/types/application/application.d.ts +22 -0
- package/lib/esm/types/application/application.d.ts.map +1 -0
- package/lib/esm/types/application/index.d.ts +3 -0
- package/lib/esm/types/application/index.d.ts.map +1 -0
- package/lib/esm/types/console/console.d.ts +10 -0
- package/lib/esm/types/console/console.d.ts.map +1 -0
- package/lib/esm/types/console/index.d.ts +2 -0
- package/lib/esm/types/console/index.d.ts.map +1 -0
- package/lib/esm/types/container-module/container-module.d.ts +9 -0
- package/lib/esm/types/container-module/container-module.d.ts.map +1 -0
- package/lib/esm/types/container-module/index.d.ts +2 -0
- package/lib/esm/types/container-module/index.d.ts.map +1 -0
- package/lib/esm/types/controller/base-controller.d.ts +9 -0
- package/lib/esm/types/controller/base-controller.d.ts.map +1 -0
- package/lib/esm/types/controller/index.d.ts +2 -0
- package/lib/esm/types/controller/index.d.ts.map +1 -0
- package/lib/esm/types/environment/env-validator.d.ts +13 -0
- package/lib/esm/types/environment/env-validator.d.ts.map +1 -0
- package/lib/esm/types/environment/index.d.ts +2 -0
- package/lib/esm/types/environment/index.d.ts.map +1 -0
- package/lib/esm/types/error/application-error.d.ts +7 -0
- package/lib/esm/types/error/application-error.d.ts.map +1 -0
- package/lib/esm/types/error/error-handler-middleware.d.ts +5 -0
- package/lib/esm/types/error/error-handler-middleware.d.ts.map +1 -0
- package/lib/esm/types/error/index.d.ts +4 -0
- package/lib/esm/types/error/index.d.ts.map +1 -0
- package/lib/esm/types/error/report.d.ts +6 -0
- package/lib/esm/types/error/report.d.ts.map +1 -0
- package/lib/esm/types/error/status-code.d.ts +137 -0
- package/lib/esm/types/error/status-code.d.ts.map +1 -0
- package/lib/esm/types/index.d.ts +8 -0
- package/lib/esm/types/index.d.ts.map +1 -0
- package/lib/esm/types/logger/general-logger.d.ts +17 -0
- package/lib/esm/types/logger/general-logger.d.ts.map +1 -0
- package/lib/esm/types/logger/index.d.ts +2 -0
- package/lib/esm/types/logger/index.d.ts.map +1 -0
- package/lib/package.json +146 -0
- package/package.json +109 -12
- package/application/app-container.js +0 -20
- package/controller/base-controller.js +0 -37
- package/error/application-error.js +0 -18
- package/error/report.js +0 -15
- package/index.js +0 -10
- /package/{application → lib/cjs/application}/index.js +0 -0
- /package/{console → lib/cjs/console}/index.js +0 -0
- /package/{container-module → lib/cjs/container-module}/index.js +0 -0
- /package/{controller → lib/cjs/controller}/index.js +0 -0
- /package/{environment → lib/cjs/environment}/index.js +0 -0
- /package/{error → lib/cjs/error}/error-handler-middleware.js +0 -0
- /package/{error → lib/cjs/error}/index.js +0 -0
- /package/{error → lib/cjs/error}/status-code.js +0 -0
- /package/{logger → lib/cjs/logger}/index.js +0 -0
- /package/{application/index.d.ts → lib/esm/application/index.js} +0 -0
- /package/{container-module/index.d.ts → lib/esm/container-module/index.js} +0 -0
- /package/{controller/index.d.ts → lib/esm/controller/index.js} +0 -0
- /package/{environment/index.d.ts → lib/esm/environment/index.js} +0 -0
- /package/{error/index.d.ts → lib/esm/error/index.js} +0 -0
- /package/{index.d.ts → lib/esm/index.mjs} +0 -0
- /package/{logger/index.d.ts → lib/esm/logger/index.js} +0 -0
package/README.md
CHANGED
|
@@ -8,146 +8,57 @@ A Typescript + [Node.js]("https://nodejs.org/en/") lightweight framework for qui
|
|
|
8
8
|
|
|
9
9
|
## Philosophy
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
ExpressoTS is a developer-friendly framework designed to streamline the process of building server-side applications. With a focus on readability, maintainability, and scalability, ExpressoTS aims to simplify the development process by providing a clear and concise structure.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Gone are the days of tedious setup tasks such as configuring logging systems, handling authentication, and connecting to databases. With ExpressoTS, developers can focus on what really matters - writing code. The framework takes care of the repetitive and time-consuming aspects of development, allowing developers to work more efficiently.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
One of the key features of Expresso TS is its flexible and extensible architecture. The framework provides a simple but powerful dependency injection system that enables developers to quickly and easily extend its functionality by creating and adding providers. This allows developers to seamlessly integrate new features throughout the entire application without having to worry about the complexities of integration.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Whether you're building a simple API or a complex enterprise application, Expresso TS can help you deliver your project on time and on budget. With a comprehensive set of tools and features, Expresso TS makes it easy to build high-quality, scalable, and maintainable server-side applications.
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
It respects the fundamentals of clean code and some of the SOLID concepts. This boilerplate has my own flavour, which means that I don't follow follow strictly all the concepts, I rather customize to my own needs. I tried to extract the best practices of the 5 main principles:
|
|
22
|
-
|
|
23
|
-
- **_S_**: Single responsibility
|
|
24
|
-
- **_O_**: Open-Close
|
|
25
|
-
- **_L_**: Liskov substitution
|
|
26
|
-
- **_I_**: Interface segregation
|
|
27
|
-
- **_D_**: Dependency inversion
|
|
28
|
-
|
|
29
|
-
`Reference:` [Uncle Bob article](http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod)
|
|
30
|
-
|
|
31
|
-
> 
|
|
32
|
-
|
|
33
|
-
- **_Entities_**: class definitions, or models with their attributes, properties and methods.
|
|
34
|
-
- **_Providers_**: is the layer responsible to provide externals resources such as database, email services. Everything external to the application.
|
|
35
|
-
- **_Repositories_**: is the layer responsible to communicate with the database.
|
|
36
|
-
- **_Use Cases_**: use cases represents the implementation of an operation that can be performed in the system
|
|
37
|
-
|
|
38
|
-
## Key Features
|
|
39
|
-
|
|
40
|
-
- Module mapping (tsconfig-paths) : Entity, Provider, Use case, repository, controller examples
|
|
41
|
-
- IOC (Inversion of control): Dependency Injection with InversifyJS
|
|
42
|
-
- API Decorators: HttpGet, HttpPost, HttpPut, HttpDelete, HttpPatch, HttpOptions, HttpHead
|
|
43
|
-
- Error handling
|
|
44
|
-
- API Logger : Morgan
|
|
45
|
-
- Application General Logger: Winston
|
|
46
|
-
- App container and module creation
|
|
47
|
-
|
|
48
|
-
## Feature Details
|
|
49
|
-
|
|
50
|
-
- **Module Mapping**: Using the tsconfig-paths module, we are mapping the entities, providers, repositories, use cases folders, so that we can import them using relative paths. This allows us to create a project structure that is configured using a development pattern.
|
|
51
|
-
|
|
52
|
-
```json
|
|
53
|
-
"paths": {
|
|
54
|
-
"@entities/*": ["entities/*"],
|
|
55
|
-
"@providers/*": ["providers/*"],
|
|
56
|
-
"@repositories/*": ["repositories/*"],
|
|
57
|
-
"@useCases/*": ["useCases/*"],
|
|
58
|
-
},
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
- **IOC**: Using InversifyJS we are creating the IoC container and registering all the dependencies. The project contains AppContainer class to register the modules, and a mechanism to create modules in which controllers can bind to it.
|
|
62
|
-
|
|
63
|
-
AppContainer for registering the modules:
|
|
64
|
-
|
|
65
|
-
```typescript
|
|
66
|
-
const container = new Container();
|
|
67
|
-
|
|
68
|
-
container.load(buildProviderModule(), UserContainerModule);
|
|
69
|
-
|
|
70
|
-
export { container };
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Creating the modules and registering the controllers:
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
export const UserContainerModule = CreateModule([
|
|
77
|
-
CreateUserController,
|
|
78
|
-
DeleteUserController,
|
|
79
|
-
FindByIdController,
|
|
80
|
-
UpdateUserController,
|
|
81
|
-
FindAllUsersController,
|
|
82
|
-
]);
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
- **API Decorators**: Using the decorators we are creating the endpoints for the controllers.
|
|
86
|
-
|
|
87
|
-
```typescript
|
|
88
|
-
@controller('/user/create')
|
|
89
|
-
@httpPost('/')
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
- **Entity, Provider, Use case, repository, controller examples**: Folders organization for the clean architecture.
|
|
93
|
-
|
|
94
|
-
- **Error handling**: Using `Report.Error()` we can report errors using predefined error codes. This is useful when we want to report known errors to the client. Inside of `Report.Error()` there is a try catch block encapsulating the error.
|
|
19
|
+
## Getting Started
|
|
95
20
|
|
|
96
|
-
|
|
97
|
-
|
|
21
|
+
- Here is our [Official Documentation](https://expresso-ts.com/)
|
|
22
|
+
- Checkout our [First Steps documentation](https://expresso-ts.com/docs/overview/first-steps)
|
|
23
|
+
- Our [CLI Documentation](https://expresso-ts.com/docs/category/cli)
|
|
98
24
|
|
|
99
|
-
|
|
100
|
-
if (userExist) {
|
|
101
|
-
const error = Report.Error(new ApplicationError(StatusCode.BadRequest, "User already exist!"), "user-create");
|
|
102
|
-
return error;
|
|
103
|
-
}
|
|
104
|
-
```
|
|
25
|
+
## Questions
|
|
105
26
|
|
|
106
|
-
|
|
27
|
+
For questions and support please use the Official [Discord Channel](https://discord.com/invite/PyPJfGK). We have a very active community there, that will be happy to help you. Post your questions in the channel called **HELP EXPRESSO TS** and forum called **help**.
|
|
107
28
|
|
|
108
|
-
|
|
109
|
-
[localhost ::ffff:127.0.0.1]-[2023-02-02 17:2:16]-[pid: 48644] POST /user/create 151 - 0.007 ms - -
|
|
110
|
-
```
|
|
29
|
+
## Issues
|
|
111
30
|
|
|
112
|
-
|
|
31
|
+
The [Issue Reporting Channel](https://github.com/expressots/expressots/issues) is for bug report and feature request **only**.
|
|
113
32
|
|
|
114
|
-
|
|
115
|
-
[2023-02-01 20:27:58] [core-api] [user-create] error: User already exist! - (Error) [file: CreateUserUseCase.<anonymous> (<app_path>\src\useCases\user\create\CreateUser.UseCase.ts:31:50)]
|
|
116
|
-
```
|
|
33
|
+
Before you create an issue, please make sure you read the [Contribution Guidelines](CONTRIBUTING.md).
|
|
117
34
|
|
|
118
|
-
|
|
35
|
+
## Support
|
|
119
36
|
|
|
120
|
-
|
|
121
|
-
Log(LogLevel.Error, error, this.serviceName);
|
|
122
|
-
```
|
|
37
|
+
ExpressoTS is an MIT-licensed open source project. It's an independent project with ongoing development made possible thanks to your support. If you'd like to help, please consider:
|
|
123
38
|
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
39
|
+
- Become a sponsor on GitHub
|
|
40
|
+
- Follow the organization on GitHub and Star the project
|
|
41
|
+
- Contribute submitting issues and pull requests
|
|
42
|
+
- Share the project with your friends and colleagues
|
|
127
43
|
|
|
128
|
-
##
|
|
44
|
+
## Contributors
|
|
129
45
|
|
|
130
|
-
|
|
46
|
+
- [Daniel Boll](https://github.com/daniel-boll)
|
|
47
|
+
- [Eduardo Parreiras](https://github.com/duduzcouto)
|
|
48
|
+
- [Felipe Fontana](https://github.com/f0ntana)
|
|
49
|
+
- [Juliano Soares](https://github.com/juliano-soares)
|
|
50
|
+
- [Vitor Caminha](https://github.com/VitorCaminha)
|
|
131
51
|
|
|
132
|
-
|
|
133
|
-
1. run `yarn install` to install all dependencies
|
|
134
|
-
2. run `yarn start` to start the project
|
|
52
|
+
## Backers
|
|
135
53
|
|
|
136
|
-
|
|
137
|
-
4. create the user and password in mongodb and apply management rights
|
|
138
|
-
5. add the user and password to the .env file
|
|
139
|
-
```
|
|
54
|
+
- Work in progress
|
|
140
55
|
|
|
141
|
-
##
|
|
56
|
+
## Stay in touch
|
|
142
57
|
|
|
143
|
-
|
|
58
|
+
- Author: Richard Zampieri
|
|
59
|
+
- Website: [https://expresso-ts.com](https://expresso-ts.com)
|
|
60
|
+
- Twitch channel: [Richard Zampieri](https://www.twitch.tv/richardzampieri)
|
|
144
61
|
|
|
145
|
-
##
|
|
62
|
+
## License
|
|
146
63
|
|
|
147
|
-
|
|
148
|
-
1. Clone it to your local
|
|
149
|
-
2. Contribute to it
|
|
150
|
-
3. Push it to your remote repo
|
|
151
|
-
4. Send a PR to the main repo with your branch
|
|
152
|
-
5. Your contribution will be evaluated then we will merge your changes with the original repository.
|
|
153
|
-
```
|
|
64
|
+
ExpressoTS is **[MIT licensed](LICENSE.md)**
|
package/lib/CHANGELOG.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
## [1.1.0](https://github.com/expressots/expressots/compare/v1.1.0-42-gc6f184868daa1b6862337621c69b5370b70a2772...v1.1.0) (2023-03-31)
|
|
4
|
+
|
|
5
|
+
## [1.2.0](https://github.com/expressots/expressots/compare/v1.1.0-41-gf2a0fd59ba849c6ee880121d773da15fe2580cb1...v1.2.0) (2023-03-31)
|
|
6
|
+
|
|
7
|
+
## [1.1.0](https://github.com/expressots/expressots/compare/v1.1.0-39-g71dbe2f089dcef87a2d71c00043eeb7ce4427771...v1.1.0) (2023-03-31)
|
|
8
|
+
|
|
9
|
+
## [1.1.0](https://github.com/expressots/expressots/compare/v1.1.0-37-g3e82d383af42099e2d3b0b347916e21dbbdd93c9...v1.1.0) (2023-03-31)
|
|
10
|
+
|
|
11
|
+
## [1.2.0](https://github.com/expressots/expressots/compare/v1.1.0-35-g27548a8d24a0891d1d04fca1ba131ad585fba5ef...v1.2.0) (2023-03-31)
|
|
12
|
+
|
|
13
|
+
* feat: add cjs/esm (92f858f)
|
|
14
|
+
|
|
15
|
+
## [1.1.0](https://github.com/expressots/expressots/compare/v1.1.0-32-gd0aa36eefab521c3be83d72c873e3d34d4ea88eb...v1.1.0) (2023-03-31)
|
|
16
|
+
|
|
17
|
+
## [1.2.0](https://github.com/expressots/expressots/compare/v1.1.0-27-g56b160429e341c190355e4003901cb8b0ddbe792...v1.2.0) (2023-03-31)
|
|
18
|
+
|
|
19
|
+
## [1.1.0](https://github.com/expressots/expressots/compare/v0.0.2...v1.1.0) (2023-02-19)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* add eslint prettier config ([906cdcc](https://github.com/expressots/expressots/commit/906cdcc0ebf00bee55c8cab66e95dd74c9296cb8))
|
|
25
|
+
* add opinionated template ([d1eb222](https://github.com/expressots/expressots/commit/d1eb222016c809a1a4576cce5b51660d55ad7c19))
|
|
26
|
+
* add readme ([557e1ff](https://github.com/expressots/expressots/commit/557e1ffcd41d1e482372183a0ea72820531740d7))
|
|
27
|
+
* update 01_base template ([d289c57](https://github.com/expressots/expressots/commit/d289c5752bb78ad6bce7f35fcdb7019e7cc38b6a))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* add ping controller ([ca7b005](https://github.com/expressots/expressots/commit/ca7b005be099eadc35b5e6b96aaf82c0e3840c81))
|
|
33
|
+
* fix index.js main on package ([26596b7](https://github.com/expressots/expressots/commit/26596b7982143e63186461bde1324a81a8901446))
|
|
34
|
+
* fix jest compilation error ([9c5be2e](https://github.com/expressots/expressots/commit/9c5be2e8a1dc062618d048183dfeef08d67d8e70))
|
|
35
|
+
* fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
|
|
36
|
+
* logo update on doc ([b2fe55b](https://github.com/expressots/expressots/commit/b2fe55b54fcac09bf261b5ea5cab4ebdbe20dee1))
|
|
37
|
+
* logo update on doc, build update ([b36889d](https://github.com/expressots/expressots/commit/b36889d513ed07678b43f7107ef9cd49ab5f8afa))
|
|
38
|
+
* non opinionated folder and prettier ([61d1e1b](https://github.com/expressots/expressots/commit/61d1e1b45e9bd240d4a6fd12a71f814e0426a436))
|
|
39
|
+
* prettier eslint jest setup ([0f29452](https://github.com/expressots/expressots/commit/0f29452c796abefe205ece8b943efda24b383905))
|
|
40
|
+
* remove test-app ([767c7a5](https://github.com/expressots/expressots/commit/767c7a54ea65c228a94ba3d63e5b6739c474a96e))
|
|
41
|
+
* set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
|
|
42
|
+
* update main remove index.js ([8b40b11](https://github.com/expressots/expressots/commit/8b40b11c51da728db4f8760e75fee1e2724e98e0))
|
|
43
|
+
* update readme ([a2ef784](https://github.com/expressots/expressots/commit/a2ef7849a1c1466f8737f263ad1728f5d30b25ec))
|
|
44
|
+
|
|
45
|
+
## [0.0.7](https://github.com/expressots/expressots/compare/v0.0.2...v0.0.7) (2023-02-18)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Bug Fixes
|
|
49
|
+
|
|
50
|
+
* fix release step ([6e4d7b9](https://github.com/expressots/expressots/commit/6e4d7b956833cf9f956c4dbb0e063d9e50f92e3e))
|
|
51
|
+
* fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
|
|
52
|
+
* set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
|
|
53
|
+
|
|
54
|
+
## [0.0.6](https://github.com/expressots/expressots/compare/v0.0.2...v0.0.6) (2023-02-17)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Bug Fixes
|
|
58
|
+
|
|
59
|
+
* fix pipeline release ([69e3fc4](https://github.com/expressots/expressots/commit/69e3fc497b8b4c79556663a768c1aab417c5bca6))
|
|
60
|
+
* fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
|
|
61
|
+
* set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
|
|
62
|
+
|
|
63
|
+
## [0.0.5](https://github.com/expressots/expressots/compare/v0.0.2...v0.0.5) (2023-02-17)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Bug Fixes
|
|
67
|
+
|
|
68
|
+
* fix pipeline on push ([da20e93](https://github.com/expressots/expressots/commit/da20e93665a7fd51f449f0c6ae71cd485028d1f4))
|
|
69
|
+
* fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
|
|
70
|
+
* set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
|
|
71
|
+
|
|
72
|
+
## [0.0.4](https://github.com/expressots/expressots/compare/v0.0.2...v0.0.4) (2023-02-17)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### Bug Fixes
|
|
76
|
+
|
|
77
|
+
* fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
|
|
78
|
+
* set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
|
|
79
|
+
* update pipeline ([27dd961](https://github.com/expressots/expressots/commit/27dd961230f5cd2b1b02937f8c77ead9e983e537))
|
|
80
|
+
|
|
81
|
+
## [0.0.3](https://github.com/expressots/expressots/compare/v0.0.2...v0.0.3) (2023-02-17)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
### Bug Fixes
|
|
85
|
+
|
|
86
|
+
* fix release tag pipeline ([ed03d24](https://github.com/expressots/expressots/commit/ed03d24e2696279aa04c8988e2c52ba7209a7bbd))
|
|
87
|
+
* set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
|
|
88
|
+
|
|
89
|
+
## [0.0.2](https://github.com/expressots/expressots/compare/v0.1.1...v0.0.2) (2023-02-17)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
### Bug Fixes
|
|
93
|
+
|
|
94
|
+
* fix pipeline for tag name ([b9ec52d](https://github.com/expressots/expressots/commit/b9ec52dc065763185f69364d8f083b1a95fa37e0))
|
|
95
|
+
|
|
96
|
+
## [0.0.1](https://github.com/expressots/expressots/compare/v0.1.1...v0.0.1) (2023-02-17)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
### Bug Fixes
|
|
100
|
+
|
|
101
|
+
* fix pipeline for tag name ([b9ec52d](https://github.com/expressots/expressots/commit/b9ec52dc065763185f69364d8f083b1a95fa37e0))
|
package/lib/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://expresso-ts.com/" target="blank"><img src="https://github.com/expressots/expressots/blob/main/media/alogo.png" width="120" alt="Expresso TS Logo" /></a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# Expresso TS
|
|
6
|
+
|
|
7
|
+
A Typescript + [Node.js]("https://nodejs.org/en/") lightweight framework for quick building scalable, easy to read and maintain, server-side applications 🚀
|
|
8
|
+
|
|
9
|
+
## Philosophy
|
|
10
|
+
|
|
11
|
+
ExpressoTS is a developer-friendly framework designed to streamline the process of building server-side applications. With a focus on readability, maintainability, and scalability, ExpressoTS aims to simplify the development process by providing a clear and concise structure.
|
|
12
|
+
|
|
13
|
+
Gone are the days of tedious setup tasks such as configuring logging systems, handling authentication, and connecting to databases. With ExpressoTS, developers can focus on what really matters - writing code. The framework takes care of the repetitive and time-consuming aspects of development, allowing developers to work more efficiently.
|
|
14
|
+
|
|
15
|
+
One of the key features of Expresso TS is its flexible and extensible architecture. The framework provides a simple but powerful dependency injection system that enables developers to quickly and easily extend its functionality by creating and adding providers. This allows developers to seamlessly integrate new features throughout the entire application without having to worry about the complexities of integration.
|
|
16
|
+
|
|
17
|
+
Whether you're building a simple API or a complex enterprise application, Expresso TS can help you deliver your project on time and on budget. With a comprehensive set of tools and features, Expresso TS makes it easy to build high-quality, scalable, and maintainable server-side applications.
|
|
18
|
+
|
|
19
|
+
## Getting Started
|
|
20
|
+
|
|
21
|
+
- Here is our [Official Documentation](https://expresso-ts.com/)
|
|
22
|
+
- Checkout our [First Steps documentation](https://expresso-ts.com/docs/overview/first-steps)
|
|
23
|
+
- Our [CLI Documentation](https://expresso-ts.com/docs/category/cli)
|
|
24
|
+
|
|
25
|
+
## Questions
|
|
26
|
+
|
|
27
|
+
For questions and support please use the Official [Discord Channel](https://discord.com/invite/PyPJfGK). We have a very active community there, that will be happy to help you. Post your questions in the channel called **HELP EXPRESSO TS** and forum called **help**.
|
|
28
|
+
|
|
29
|
+
## Issues
|
|
30
|
+
|
|
31
|
+
The [Issue Reporting Channel](https://github.com/expressots/expressots/issues) is for bug report and feature request **only**.
|
|
32
|
+
|
|
33
|
+
Before you create an issue, please make sure you read the [Contribution Guidelines](CONTRIBUTING.md).
|
|
34
|
+
|
|
35
|
+
## Support
|
|
36
|
+
|
|
37
|
+
ExpressoTS is an MIT-licensed open source project. It's an independent project with ongoing development made possible thanks to your support. If you'd like to help, please consider:
|
|
38
|
+
|
|
39
|
+
- Become a sponsor on GitHub
|
|
40
|
+
- Follow the organization on GitHub and Star the project
|
|
41
|
+
- Contribute submitting issues and pull requests
|
|
42
|
+
- Share the project with your friends and colleagues
|
|
43
|
+
|
|
44
|
+
## Contributors
|
|
45
|
+
|
|
46
|
+
- [Daniel Boll](https://github.com/daniel-boll)
|
|
47
|
+
- [Eduardo Parreiras](https://github.com/duduzcouto)
|
|
48
|
+
- [Felipe Fontana](https://github.com/f0ntana)
|
|
49
|
+
- [Juliano Soares](https://github.com/juliano-soares)
|
|
50
|
+
- [Vitor Caminha](https://github.com/VitorCaminha)
|
|
51
|
+
|
|
52
|
+
## Backers
|
|
53
|
+
|
|
54
|
+
- Work in progress
|
|
55
|
+
|
|
56
|
+
## Stay in touch
|
|
57
|
+
|
|
58
|
+
- Author: Richard Zampieri
|
|
59
|
+
- Website: [https://expresso-ts.com](https://expresso-ts.com)
|
|
60
|
+
- Twitch channel: [Richard Zampieri](https://www.twitch.tv/richardzampieri)
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
ExpressoTS is **[MIT licensed](LICENSE.md)**
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var AppContainer_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.AppContainer = void 0;
|
|
14
|
+
const inversify_1 = require("inversify");
|
|
15
|
+
const inversify_binding_decorators_1 = require("inversify-binding-decorators");
|
|
16
|
+
let AppContainer = AppContainer_1 = class AppContainer {
|
|
17
|
+
constructor() { }
|
|
18
|
+
create(modules) {
|
|
19
|
+
this.container = new inversify_1.Container();
|
|
20
|
+
this.container.load((0, inversify_binding_decorators_1.buildProviderModule)(), ...modules);
|
|
21
|
+
return this.container;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
AppContainer = AppContainer_1 = __decorate([
|
|
25
|
+
(0, inversify_binding_decorators_1.provide)(AppContainer_1),
|
|
26
|
+
__metadata("design:paramtypes", [])
|
|
27
|
+
], AppContainer);
|
|
28
|
+
exports.AppContainer = AppContainer;
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
2
14
|
var Application_1;
|
|
3
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
16
|
exports.ServerEnvironment = exports.Application = exports.AppInstance = void 0;
|
|
5
|
-
const
|
|
6
|
-
const express_1 = tslib_1.__importDefault(require("express"));
|
|
17
|
+
const express_1 = __importDefault(require("express"));
|
|
7
18
|
const inversify_binding_decorators_1 = require("inversify-binding-decorators");
|
|
8
19
|
const inversify_express_utils_1 = require("inversify-express-utils");
|
|
9
|
-
const process_1 =
|
|
20
|
+
const process_1 = __importDefault(require("process"));
|
|
10
21
|
const console_1 = require("../console/console");
|
|
11
|
-
const error_handler_middleware_1 =
|
|
22
|
+
const error_handler_middleware_1 = __importDefault(require("../error/error-handler-middleware"));
|
|
12
23
|
var ServerEnvironment;
|
|
13
24
|
(function (ServerEnvironment) {
|
|
14
25
|
ServerEnvironment["Development"] = "development";
|
|
@@ -53,9 +64,9 @@ let Application = Application_1 = class Application {
|
|
|
53
64
|
this.postServerInitialization();
|
|
54
65
|
}
|
|
55
66
|
};
|
|
56
|
-
Application = Application_1 =
|
|
67
|
+
Application = Application_1 = __decorate([
|
|
57
68
|
(0, inversify_binding_decorators_1.provide)(Application_1),
|
|
58
|
-
|
|
69
|
+
__metadata("design:paramtypes", [])
|
|
59
70
|
], Application);
|
|
60
71
|
exports.Application = Application;
|
|
61
72
|
const appServerInstance = new Application();
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
var Console_1;
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.Console = void 0;
|
|
23
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
24
|
+
const inversify_binding_decorators_1 = require("inversify-binding-decorators");
|
|
25
|
+
var ColorStyle;
|
|
26
|
+
(function (ColorStyle) {
|
|
27
|
+
ColorStyle[ColorStyle["None"] = 0] = "None";
|
|
28
|
+
ColorStyle[ColorStyle["Yellow"] = 1] = "Yellow";
|
|
29
|
+
ColorStyle[ColorStyle["Blue"] = 2] = "Blue";
|
|
30
|
+
ColorStyle[ColorStyle["Green"] = 3] = "Green";
|
|
31
|
+
ColorStyle[ColorStyle["Red"] = 4] = "Red";
|
|
32
|
+
})(ColorStyle || (ColorStyle = {}));
|
|
33
|
+
let Console = Console_1 = class Console {
|
|
34
|
+
printColor(message, colorStyle) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
switch (colorStyle) {
|
|
37
|
+
case ColorStyle.Yellow:
|
|
38
|
+
return console.log(chalk_1.default.bgYellow.black(message));
|
|
39
|
+
case ColorStyle.Blue:
|
|
40
|
+
return console.log(chalk_1.default.bgBlue.black(message));
|
|
41
|
+
case ColorStyle.Green:
|
|
42
|
+
return console.log(chalk_1.default.bgGreen.black(message));
|
|
43
|
+
case ColorStyle.Red:
|
|
44
|
+
return console.log(chalk_1.default.bgRed.black(message));
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
messageServer(port, environment, consoleMessage) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const appConsoleMessage = {
|
|
51
|
+
appName: (consoleMessage === null || consoleMessage === void 0 ? void 0 : consoleMessage.appName) || "Application",
|
|
52
|
+
appVersion: (consoleMessage === null || consoleMessage === void 0 ? void 0 : consoleMessage.appVersion) || "not provided",
|
|
53
|
+
};
|
|
54
|
+
let terminalColor = ColorStyle.None;
|
|
55
|
+
switch (environment.toLowerCase()) {
|
|
56
|
+
case "development":
|
|
57
|
+
terminalColor = ColorStyle.Yellow;
|
|
58
|
+
break;
|
|
59
|
+
case "staging":
|
|
60
|
+
terminalColor = ColorStyle.Blue;
|
|
61
|
+
break;
|
|
62
|
+
case "production":
|
|
63
|
+
terminalColor = ColorStyle.Green;
|
|
64
|
+
break;
|
|
65
|
+
default:
|
|
66
|
+
terminalColor = ColorStyle.Red;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
this.printColor(`${appConsoleMessage.appName} version ${appConsoleMessage.appVersion} is running on ` +
|
|
70
|
+
`port ${port} - Environment: ${environment}`, terminalColor);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
Console = Console_1 = __decorate([
|
|
75
|
+
(0, inversify_binding_decorators_1.provide)(Console_1)
|
|
76
|
+
], Console);
|
|
77
|
+
exports.Console = Console;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
2
11
|
var BaseModule_1;
|
|
3
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
13
|
exports.CreateModule = void 0;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
14
|
const inversify_1 = require("inversify");
|
|
7
15
|
const inversify_binding_decorators_1 = require("inversify-binding-decorators");
|
|
8
16
|
let BaseModule = BaseModule_1 = class BaseModule {
|
|
@@ -26,9 +34,9 @@ let BaseModule = BaseModule_1 = class BaseModule {
|
|
|
26
34
|
});
|
|
27
35
|
}
|
|
28
36
|
};
|
|
29
|
-
BaseModule = BaseModule_1 =
|
|
37
|
+
BaseModule = BaseModule_1 = __decorate([
|
|
30
38
|
(0, inversify_binding_decorators_1.provide)(BaseModule_1),
|
|
31
|
-
|
|
39
|
+
__metadata("design:paramtypes", [])
|
|
32
40
|
], BaseModule);
|
|
33
41
|
const CreateModule = BaseModule.createContainerModule;
|
|
34
42
|
exports.CreateModule = CreateModule;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var BaseController_1;
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.BaseController = void 0;
|
|
23
|
+
const inversify_binding_decorators_1 = require("inversify-binding-decorators");
|
|
24
|
+
const error_1 = require("../error");
|
|
25
|
+
let BaseController = BaseController_1 = class BaseController {
|
|
26
|
+
constructor(serviceName) {
|
|
27
|
+
this.serviceName = serviceName;
|
|
28
|
+
}
|
|
29
|
+
callUseCaseAsync(useCase, res, successStatusCode) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
let dataReturn;
|
|
32
|
+
try {
|
|
33
|
+
dataReturn = yield useCase;
|
|
34
|
+
return res.status(successStatusCode).json(dataReturn);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
error_1.Report.Error(error);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
callUseCase(useCase, res, successStatusCode) {
|
|
42
|
+
let dataReturn;
|
|
43
|
+
try {
|
|
44
|
+
dataReturn = useCase;
|
|
45
|
+
return res.status(successStatusCode).json(dataReturn);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
error_1.Report.Error(error);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
BaseController = BaseController_1 = __decorate([
|
|
53
|
+
(0, inversify_binding_decorators_1.provide)(BaseController_1),
|
|
54
|
+
__metadata("design:paramtypes", [String])
|
|
55
|
+
], BaseController);
|
|
56
|
+
exports.BaseController = BaseController;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
2
11
|
var EnvValidatorProvider_1;
|
|
3
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
13
|
exports.Environments = void 0;
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const dotenv_1 = tslib_1.__importDefault(require("dotenv"));
|
|
14
|
+
const fs_1 = __importDefault(require("fs"));
|
|
15
|
+
const path_1 = __importDefault(require("path"));
|
|
16
|
+
const dotenv_1 = __importDefault(require("dotenv"));
|
|
9
17
|
const inversify_binding_decorators_1 = require("inversify-binding-decorators");
|
|
10
18
|
const logger_1 = require("../logger");
|
|
11
19
|
let EnvValidatorProvider = EnvValidatorProvider_1 = class EnvValidatorProvider {
|
|
@@ -38,7 +46,7 @@ let EnvValidatorProvider = EnvValidatorProvider_1 = class EnvValidatorProvider {
|
|
|
38
46
|
}
|
|
39
47
|
}
|
|
40
48
|
};
|
|
41
|
-
EnvValidatorProvider = EnvValidatorProvider_1 =
|
|
49
|
+
EnvValidatorProvider = EnvValidatorProvider_1 = __decorate([
|
|
42
50
|
(0, inversify_binding_decorators_1.provide)(EnvValidatorProvider_1)
|
|
43
51
|
], EnvValidatorProvider);
|
|
44
52
|
exports.Environments = EnvValidatorProvider;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var AppError_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.AppError = void 0;
|
|
14
|
+
const inversify_binding_decorators_1 = require("inversify-binding-decorators");
|
|
15
|
+
let AppError = AppError_1 = class AppError extends Error {
|
|
16
|
+
constructor(statusCode, message, service) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.statusCode = statusCode;
|
|
19
|
+
this.service = service;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
AppError = AppError_1 = __decorate([
|
|
23
|
+
(0, inversify_binding_decorators_1.provide)(AppError_1),
|
|
24
|
+
__metadata("design:paramtypes", [Number, String, String])
|
|
25
|
+
], AppError);
|
|
26
|
+
exports.AppError = AppError;
|