@expressots/core 1.0.1 → 1.2.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.
Files changed (149) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +33 -122
  3. package/lib/CHANGELOG.md +120 -0
  4. package/lib/README.md +64 -0
  5. package/lib/cjs/application/app-container.js +40 -0
  6. package/{application → lib/cjs/application}/application.js +101 -62
  7. package/{application → lib/cjs/application}/index.js +9 -9
  8. package/lib/cjs/common/index.js +2 -0
  9. package/lib/cjs/common/project-config.provider.js +2 -0
  10. package/lib/cjs/console/console.js +95 -0
  11. package/{console → lib/cjs/console}/index.js +5 -5
  12. package/lib/cjs/container-module/container-module.js +56 -0
  13. package/{container-module → lib/cjs/container-module}/index.js +5 -5
  14. package/lib/cjs/controller/base-controller.js +77 -0
  15. package/{controller → lib/cjs/controller}/index.js +5 -5
  16. package/{environment → lib/cjs/environment}/env-validator.js +87 -64
  17. package/{environment → lib/cjs/environment}/index.js +5 -5
  18. package/lib/cjs/error/application-error.js +37 -0
  19. package/{error → lib/cjs/error}/error-handler-middleware.js +17 -9
  20. package/{error → lib/cjs/error}/index.js +9 -9
  21. package/lib/cjs/error/report.js +27 -0
  22. package/{error → lib/cjs/error}/status-code.js +83 -83
  23. package/lib/cjs/index.js +24 -0
  24. package/{logger → lib/cjs/logger}/general-logger.js +132 -92
  25. package/{logger → lib/cjs/logger}/index.js +7 -7
  26. package/lib/cjs/types/application/app-container.d.ts +20 -0
  27. package/lib/cjs/types/application/app-container.d.ts.map +1 -0
  28. package/lib/cjs/types/application/application.d.ts +53 -0
  29. package/lib/cjs/types/application/application.d.ts.map +1 -0
  30. package/lib/cjs/types/application/index.d.ts +3 -0
  31. package/lib/cjs/types/application/index.d.ts.map +1 -0
  32. package/lib/cjs/types/common/index.d.ts +2 -0
  33. package/lib/cjs/types/common/index.d.ts.map +1 -0
  34. package/lib/cjs/types/common/project-config.provider.d.ts +22 -0
  35. package/lib/cjs/types/common/project-config.provider.d.ts.map +1 -0
  36. package/lib/cjs/types/console/console.d.ts +28 -0
  37. package/lib/cjs/types/console/console.d.ts.map +1 -0
  38. package/{console → lib/cjs/types/console}/index.d.ts +2 -1
  39. package/lib/cjs/types/console/index.d.ts.map +1 -0
  40. package/lib/cjs/types/container-module/container-module.d.ts +23 -0
  41. package/lib/cjs/types/container-module/container-module.d.ts.map +1 -0
  42. package/lib/cjs/types/container-module/index.d.ts +2 -0
  43. package/lib/cjs/types/container-module/index.d.ts.map +1 -0
  44. package/lib/cjs/types/controller/base-controller.d.ts +30 -0
  45. package/lib/cjs/types/controller/base-controller.d.ts.map +1 -0
  46. package/lib/cjs/types/controller/index.d.ts +2 -0
  47. package/lib/cjs/types/controller/index.d.ts.map +1 -0
  48. package/lib/cjs/types/environment/env-validator.d.ts +28 -0
  49. package/lib/cjs/types/environment/env-validator.d.ts.map +1 -0
  50. package/lib/cjs/types/environment/index.d.ts +2 -0
  51. package/lib/cjs/types/environment/index.d.ts.map +1 -0
  52. package/lib/cjs/types/error/application-error.d.ts +18 -0
  53. package/lib/cjs/types/error/application-error.d.ts.map +1 -0
  54. package/lib/cjs/types/error/error-handler-middleware.d.ts +13 -0
  55. package/lib/cjs/types/error/error-handler-middleware.d.ts.map +1 -0
  56. package/lib/cjs/types/error/index.d.ts +4 -0
  57. package/lib/cjs/types/error/index.d.ts.map +1 -0
  58. package/lib/cjs/types/error/report.d.ts +13 -0
  59. package/lib/cjs/types/error/report.d.ts.map +1 -0
  60. package/{error → lib/cjs/types/error}/status-code.d.ts +137 -136
  61. package/lib/cjs/types/error/status-code.d.ts.map +1 -0
  62. package/lib/cjs/types/index.d.ts +9 -0
  63. package/lib/cjs/types/index.d.ts.map +1 -0
  64. package/lib/cjs/types/logger/general-logger.d.ts +46 -0
  65. package/lib/cjs/types/logger/general-logger.d.ts.map +1 -0
  66. package/lib/cjs/types/logger/index.d.ts +2 -0
  67. package/lib/cjs/types/logger/index.d.ts.map +1 -0
  68. package/lib/esm/application/app-container.js +38 -0
  69. package/lib/esm/application/application.js +96 -0
  70. package/{application/index.d.ts → lib/esm/application/index.js} +2 -2
  71. package/lib/esm/common/index.js +1 -0
  72. package/lib/esm/common/project-config.provider.js +1 -0
  73. package/lib/esm/console/console.js +76 -0
  74. package/lib/esm/console/index.js +1 -0
  75. package/lib/esm/container-module/container-module.js +53 -0
  76. package/{container-module/index.d.ts → lib/esm/container-module/index.js} +1 -1
  77. package/lib/esm/controller/base-controller.js +64 -0
  78. package/{controller/index.d.ts → lib/esm/controller/index.js} +1 -1
  79. package/lib/esm/environment/env-validator.js +80 -0
  80. package/{environment/index.d.ts → lib/esm/environment/index.js} +1 -1
  81. package/lib/esm/error/application-error.js +36 -0
  82. package/lib/esm/error/error-handler-middleware.js +15 -0
  83. package/{error/index.d.ts → lib/esm/error/index.js} +3 -3
  84. package/lib/esm/error/report.js +24 -0
  85. package/lib/esm/error/status-code.js +80 -0
  86. package/{index.d.ts → lib/esm/index.mjs} +8 -7
  87. package/lib/esm/logger/general-logger.js +125 -0
  88. package/{logger/index.d.ts → lib/esm/logger/index.js} +1 -1
  89. package/lib/esm/types/application/app-container.d.ts +20 -0
  90. package/lib/esm/types/application/app-container.d.ts.map +1 -0
  91. package/lib/esm/types/application/application.d.ts +53 -0
  92. package/lib/esm/types/application/application.d.ts.map +1 -0
  93. package/lib/esm/types/application/index.d.ts +3 -0
  94. package/lib/esm/types/application/index.d.ts.map +1 -0
  95. package/lib/esm/types/common/index.d.ts +2 -0
  96. package/lib/esm/types/common/index.d.ts.map +1 -0
  97. package/lib/esm/types/common/project-config.provider.d.ts +22 -0
  98. package/lib/esm/types/common/project-config.provider.d.ts.map +1 -0
  99. package/lib/esm/types/console/console.d.ts +28 -0
  100. package/lib/esm/types/console/console.d.ts.map +1 -0
  101. package/lib/esm/types/console/index.d.ts +2 -0
  102. package/lib/esm/types/console/index.d.ts.map +1 -0
  103. package/lib/esm/types/container-module/container-module.d.ts +23 -0
  104. package/lib/esm/types/container-module/container-module.d.ts.map +1 -0
  105. package/lib/esm/types/container-module/index.d.ts +2 -0
  106. package/lib/esm/types/container-module/index.d.ts.map +1 -0
  107. package/lib/esm/types/controller/base-controller.d.ts +30 -0
  108. package/lib/esm/types/controller/base-controller.d.ts.map +1 -0
  109. package/lib/esm/types/controller/index.d.ts +2 -0
  110. package/lib/esm/types/controller/index.d.ts.map +1 -0
  111. package/lib/esm/types/environment/env-validator.d.ts +28 -0
  112. package/lib/esm/types/environment/env-validator.d.ts.map +1 -0
  113. package/lib/esm/types/environment/index.d.ts +2 -0
  114. package/lib/esm/types/environment/index.d.ts.map +1 -0
  115. package/lib/esm/types/error/application-error.d.ts +18 -0
  116. package/lib/esm/types/error/application-error.d.ts.map +1 -0
  117. package/lib/esm/types/error/error-handler-middleware.d.ts +13 -0
  118. package/lib/esm/types/error/error-handler-middleware.d.ts.map +1 -0
  119. package/lib/esm/types/error/index.d.ts +4 -0
  120. package/lib/esm/types/error/index.d.ts.map +1 -0
  121. package/lib/esm/types/error/report.d.ts +13 -0
  122. package/lib/esm/types/error/report.d.ts.map +1 -0
  123. package/lib/esm/types/error/status-code.d.ts +137 -0
  124. package/lib/esm/types/error/status-code.d.ts.map +1 -0
  125. package/lib/esm/types/index.d.ts +9 -0
  126. package/lib/esm/types/index.d.ts.map +1 -0
  127. package/lib/esm/types/logger/general-logger.d.ts +46 -0
  128. package/lib/esm/types/logger/general-logger.d.ts.map +1 -0
  129. package/lib/esm/types/logger/index.d.ts +2 -0
  130. package/lib/esm/types/logger/index.d.ts.map +1 -0
  131. package/lib/package.json +146 -0
  132. package/package.json +109 -12
  133. package/application/app-container.d.ts +0 -7
  134. package/application/app-container.js +0 -20
  135. package/application/application.d.ts +0 -21
  136. package/console/console.d.ts +0 -9
  137. package/console/console.js +0 -56
  138. package/container-module/container-module.d.ts +0 -8
  139. package/container-module/container-module.js +0 -34
  140. package/controller/base-controller.d.ts +0 -8
  141. package/controller/base-controller.js +0 -37
  142. package/environment/env-validator.d.ts +0 -12
  143. package/error/application-error.d.ts +0 -6
  144. package/error/application-error.js +0 -18
  145. package/error/error-handler-middleware.d.ts +0 -4
  146. package/error/report.d.ts +0 -5
  147. package/error/report.js +0 -15
  148. package/index.js +0 -10
  149. package/logger/general-logger.d.ts +0 -16
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Richard Zampieri
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
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
- Expresso TS is a framework designed to make the lives of the developers easier by providing a structure for building server-side applications that is clear to read, maintain and scale. The philosophy is centered around the idea that developers should not have to waste time on repetitive tasks such as setting up a logging system, authentication, error handling, database connection, and organizing the project for better maintainability.
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
- Expresso TS offers a solution that is designed to help developers jump ahead and focus on the most important part of the development process, writing code. The framework provides capability to the developers to quickly extend the framework functionalities by creating providers and adding them to the dependency injection system. This way, developers can use these new functionalities throughout the entire application without having to worry about the complexities of integrating it into the system.
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
- ## The Project Structure
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
- ### Clean code using solid principles with Nodejs and Typescript
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
- The idea of this project is to offer a clean and concise architecture boilerplate for those trying to navigate on node development.
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
- > ![Clean Architecture](https://github.com/rsaz/cleanArchitecture01/blob/main/media/CleanArchitecture.jpg)
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
- ```typescript
97
- type ErrorType = GeneralErrorCode | ApplicationErrorCode | HttpStatusErrorCode;
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
- // Reporting errors
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
- - **API Request Logger**: Morgan is a logger for nodejs. It is a middleware that logs the requests and responses in a file.
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
- ```Text
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
- - **Application General Logger**: Winston is a logger for nodejs. It is a middleware that logs all the other exceptions in a file.
31
+ The [Issue Reporting Channel](https://github.com/expressots/expressots/issues) is for bug report and feature request **only**.
113
32
 
114
- ```Text
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
- How To Log:
35
+ ## Support
119
36
 
120
- ```typescript
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
- - LogLevel: enum with the following values: Debug, Error, Info
125
- - error: Error object
126
- - serviceName: is the name of the service that is generating the error
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
- ## Getting Started
44
+ ## Contributors
129
45
 
130
- To get started with Expresso TS, simply clone the repository and follow the below steps
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
- 3. run the docker-compose file to create the mongodb container
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
- ## Documentation
56
+ ## Stay in touch
142
57
 
143
- To be developed
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
- ## Contributing Guide
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)**
@@ -0,0 +1,120 @@
1
+
2
+
3
+ ## [1.2.0](https://github.com/expressots/expressots/compare/v1.1.0...v1.2.0) (2023-04-08)
4
+
5
+
6
+ ### Features
7
+
8
+ * add doc & config types for cli ([a72db25](https://github.com/expressots/expressots/commit/a72db25088a8c2d0a18cd8fc71dde40e01cd4c22))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * template folder path issue ([babdce9](https://github.com/expressots/expressots/commit/babdce9367f85ddd2075c4bed854ab83ee339add))
14
+
15
+ ## [1.1.1](https://github.com/expressots/expressots/compare/v1.1.0...v1.1.1) (2023-04-04)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * template folder path issue ([babdce9](https://github.com/expressots/expressots/commit/babdce9367f85ddd2075c4bed854ab83ee339add))
21
+
22
+ ## [1.1.0](https://github.com/expressots/expressots/compare/v1.1.0-42-gc6f184868daa1b6862337621c69b5370b70a2772...v1.1.0) (2023-03-31)
23
+
24
+ ## [1.2.0](https://github.com/expressots/expressots/compare/v1.1.0-41-gf2a0fd59ba849c6ee880121d773da15fe2580cb1...v1.2.0) (2023-03-31)
25
+
26
+ ## [1.1.0](https://github.com/expressots/expressots/compare/v1.1.0-39-g71dbe2f089dcef87a2d71c00043eeb7ce4427771...v1.1.0) (2023-03-31)
27
+
28
+ ## [1.1.0](https://github.com/expressots/expressots/compare/v1.1.0-37-g3e82d383af42099e2d3b0b347916e21dbbdd93c9...v1.1.0) (2023-03-31)
29
+
30
+ ## [1.2.0](https://github.com/expressots/expressots/compare/v1.1.0-35-g27548a8d24a0891d1d04fca1ba131ad585fba5ef...v1.2.0) (2023-03-31)
31
+
32
+ * feat: add cjs/esm (92f858f)
33
+
34
+ ## [1.1.0](https://github.com/expressots/expressots/compare/v1.1.0-32-gd0aa36eefab521c3be83d72c873e3d34d4ea88eb...v1.1.0) (2023-03-31)
35
+
36
+ ## [1.2.0](https://github.com/expressots/expressots/compare/v1.1.0-27-g56b160429e341c190355e4003901cb8b0ddbe792...v1.2.0) (2023-03-31)
37
+
38
+ ## [1.1.0](https://github.com/expressots/expressots/compare/v0.0.2...v1.1.0) (2023-02-19)
39
+
40
+
41
+ ### Features
42
+
43
+ * add eslint prettier config ([906cdcc](https://github.com/expressots/expressots/commit/906cdcc0ebf00bee55c8cab66e95dd74c9296cb8))
44
+ * add opinionated template ([d1eb222](https://github.com/expressots/expressots/commit/d1eb222016c809a1a4576cce5b51660d55ad7c19))
45
+ * add readme ([557e1ff](https://github.com/expressots/expressots/commit/557e1ffcd41d1e482372183a0ea72820531740d7))
46
+ * update 01_base template ([d289c57](https://github.com/expressots/expressots/commit/d289c5752bb78ad6bce7f35fcdb7019e7cc38b6a))
47
+
48
+
49
+ ### Bug Fixes
50
+
51
+ * add ping controller ([ca7b005](https://github.com/expressots/expressots/commit/ca7b005be099eadc35b5e6b96aaf82c0e3840c81))
52
+ * fix index.js main on package ([26596b7](https://github.com/expressots/expressots/commit/26596b7982143e63186461bde1324a81a8901446))
53
+ * fix jest compilation error ([9c5be2e](https://github.com/expressots/expressots/commit/9c5be2e8a1dc062618d048183dfeef08d67d8e70))
54
+ * fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
55
+ * logo update on doc ([b2fe55b](https://github.com/expressots/expressots/commit/b2fe55b54fcac09bf261b5ea5cab4ebdbe20dee1))
56
+ * logo update on doc, build update ([b36889d](https://github.com/expressots/expressots/commit/b36889d513ed07678b43f7107ef9cd49ab5f8afa))
57
+ * non opinionated folder and prettier ([61d1e1b](https://github.com/expressots/expressots/commit/61d1e1b45e9bd240d4a6fd12a71f814e0426a436))
58
+ * prettier eslint jest setup ([0f29452](https://github.com/expressots/expressots/commit/0f29452c796abefe205ece8b943efda24b383905))
59
+ * remove test-app ([767c7a5](https://github.com/expressots/expressots/commit/767c7a54ea65c228a94ba3d63e5b6739c474a96e))
60
+ * set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
61
+ * update main remove index.js ([8b40b11](https://github.com/expressots/expressots/commit/8b40b11c51da728db4f8760e75fee1e2724e98e0))
62
+ * update readme ([a2ef784](https://github.com/expressots/expressots/commit/a2ef7849a1c1466f8737f263ad1728f5d30b25ec))
63
+
64
+ ## [0.0.7](https://github.com/expressots/expressots/compare/v0.0.2...v0.0.7) (2023-02-18)
65
+
66
+
67
+ ### Bug Fixes
68
+
69
+ * fix release step ([6e4d7b9](https://github.com/expressots/expressots/commit/6e4d7b956833cf9f956c4dbb0e063d9e50f92e3e))
70
+ * fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
71
+ * set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
72
+
73
+ ## [0.0.6](https://github.com/expressots/expressots/compare/v0.0.2...v0.0.6) (2023-02-17)
74
+
75
+
76
+ ### Bug Fixes
77
+
78
+ * fix pipeline release ([69e3fc4](https://github.com/expressots/expressots/commit/69e3fc497b8b4c79556663a768c1aab417c5bca6))
79
+ * fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
80
+ * set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
81
+
82
+ ## [0.0.5](https://github.com/expressots/expressots/compare/v0.0.2...v0.0.5) (2023-02-17)
83
+
84
+
85
+ ### Bug Fixes
86
+
87
+ * fix pipeline on push ([da20e93](https://github.com/expressots/expressots/commit/da20e93665a7fd51f449f0c6ae71cd485028d1f4))
88
+ * fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
89
+ * set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
90
+
91
+ ## [0.0.4](https://github.com/expressots/expressots/compare/v0.0.2...v0.0.4) (2023-02-17)
92
+
93
+
94
+ ### Bug Fixes
95
+
96
+ * fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
97
+ * set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
98
+ * update pipeline ([27dd961](https://github.com/expressots/expressots/commit/27dd961230f5cd2b1b02937f8c77ead9e983e537))
99
+
100
+ ## [0.0.3](https://github.com/expressots/expressots/compare/v0.0.2...v0.0.3) (2023-02-17)
101
+
102
+
103
+ ### Bug Fixes
104
+
105
+ * fix release tag pipeline ([ed03d24](https://github.com/expressots/expressots/commit/ed03d24e2696279aa04c8988e2c52ba7209a7bbd))
106
+ * set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
107
+
108
+ ## [0.0.2](https://github.com/expressots/expressots/compare/v0.1.1...v0.0.2) (2023-02-17)
109
+
110
+
111
+ ### Bug Fixes
112
+
113
+ * fix pipeline for tag name ([b9ec52d](https://github.com/expressots/expressots/commit/b9ec52dc065763185f69364d8f083b1a95fa37e0))
114
+
115
+ ## [0.0.1](https://github.com/expressots/expressots/compare/v0.1.1...v0.0.1) (2023-02-17)
116
+
117
+
118
+ ### Bug Fixes
119
+
120
+ * 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,40 @@
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
+ /**
17
+ * The AppContainer class provides a container for managing dependency injection.
18
+ * @provide AppContainer
19
+ */
20
+ let AppContainer = AppContainer_1 = class AppContainer {
21
+ /**
22
+ * Constructs a new instance of the AppContainer class.
23
+ */
24
+ constructor() { }
25
+ /**
26
+ * Creates and configures a new dependency injection container.
27
+ * @param modules - An array of ContainerModule instances to load into the container.
28
+ * @returns The configured dependency injection container.
29
+ */
30
+ create(modules) {
31
+ this.container = new inversify_1.Container();
32
+ this.container.load((0, inversify_binding_decorators_1.buildProviderModule)(), ...modules);
33
+ return this.container;
34
+ }
35
+ };
36
+ AppContainer = AppContainer_1 = __decorate([
37
+ (0, inversify_binding_decorators_1.provide)(AppContainer_1),
38
+ __metadata("design:paramtypes", [])
39
+ ], AppContainer);
40
+ exports.AppContainer = AppContainer;
@@ -1,62 +1,101 @@
1
- "use strict";
2
- var Application_1;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.ServerEnvironment = exports.Application = exports.AppInstance = void 0;
5
- const tslib_1 = require("tslib");
6
- const express_1 = tslib_1.__importDefault(require("express"));
7
- const inversify_binding_decorators_1 = require("inversify-binding-decorators");
8
- const inversify_express_utils_1 = require("inversify-express-utils");
9
- const process_1 = tslib_1.__importDefault(require("process"));
10
- const console_1 = require("../console/console");
11
- const error_handler_middleware_1 = tslib_1.__importDefault(require("../error/error-handler-middleware"));
12
- var ServerEnvironment;
13
- (function (ServerEnvironment) {
14
- ServerEnvironment["Development"] = "development";
15
- ServerEnvironment["Staging"] = "staging";
16
- ServerEnvironment["Production"] = "production";
17
- })(ServerEnvironment || (ServerEnvironment = {}));
18
- exports.ServerEnvironment = ServerEnvironment;
19
- let Application = Application_1 = class Application {
20
- constructor() { }
21
- /* Add any service that you want to be initialized before the server starts */
22
- configureServices() { }
23
- /* Add any service that you want to execute after the server starts */
24
- postServerInitialization() { }
25
- /* Add any service that you want to execute after server is shutdown */
26
- serverShutdown() {
27
- process_1.default.exit(0);
28
- }
29
- create(container, middlewares = []) {
30
- this.configureServices();
31
- const expressServer = new inversify_express_utils_1.InversifyExpressServer(container);
32
- expressServer.setConfig((app) => {
33
- /* Default body parser application/json */
34
- app.use(express_1.default.json());
35
- /* Default body parser application/x-www-form-urlencoded */
36
- app.use(express_1.default.urlencoded({ extended: true }));
37
- middlewares.forEach(middleware => {
38
- app.use(middleware);
39
- });
40
- });
41
- this.app = expressServer.build();
42
- /* Add the error handler middleware */
43
- this.app.use(error_handler_middleware_1.default);
44
- return this;
45
- }
46
- listen(port, environment, consoleMessage) {
47
- this.port = port;
48
- this.environment = environment;
49
- this.app.listen(this.port, () => {
50
- new console_1.Console().messageServer(this.port, this.environment, consoleMessage);
51
- process_1.default.on("SIGINT", this.serverShutdown.bind(this));
52
- });
53
- this.postServerInitialization();
54
- }
55
- };
56
- Application = Application_1 = tslib_1.__decorate([
57
- (0, inversify_binding_decorators_1.provide)(Application_1),
58
- tslib_1.__metadata("design:paramtypes", [])
59
- ], Application);
60
- exports.Application = Application;
61
- const appServerInstance = new Application();
62
- exports.AppInstance = appServerInstance;
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
+ };
14
+ var Application_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.ServerEnvironment = exports.Application = exports.AppInstance = void 0;
17
+ const express_1 = __importDefault(require("express"));
18
+ const inversify_binding_decorators_1 = require("inversify-binding-decorators");
19
+ const inversify_express_utils_1 = require("inversify-express-utils");
20
+ const process_1 = __importDefault(require("process"));
21
+ const console_1 = require("../console/console");
22
+ const error_handler_middleware_1 = __importDefault(require("../error/error-handler-middleware"));
23
+ /**
24
+ * Enum representing possible server environments.
25
+ */
26
+ var ServerEnvironment;
27
+ (function (ServerEnvironment) {
28
+ ServerEnvironment["Development"] = "development";
29
+ ServerEnvironment["Staging"] = "staging";
30
+ ServerEnvironment["Production"] = "production";
31
+ })(ServerEnvironment || (ServerEnvironment = {}));
32
+ exports.ServerEnvironment = ServerEnvironment;
33
+ /**
34
+ * The Application class provides a way to configure and manage an Express application.
35
+ * @provide Application
36
+ */
37
+ let Application = Application_1 = class Application {
38
+ /**
39
+ * Constructs a new instance of the Application class.
40
+ */
41
+ constructor() { }
42
+ /**
43
+ * Configure services that should be initialized before the server starts.
44
+ */
45
+ configureServices() { }
46
+ /**
47
+ * Configure services that should be executed after the server starts.
48
+ */
49
+ postServerInitialization() { }
50
+ /**
51
+ * Perform actions or cleanup after the server is shutdown.
52
+ */
53
+ serverShutdown() {
54
+ process_1.default.exit(0);
55
+ }
56
+ /**
57
+ * Create and configure the Express application.
58
+ * @param container - The InversifyJS container.
59
+ * @param middlewares - An array of Express middlewares to be applied.
60
+ * @returns The configured Application instance.
61
+ */
62
+ create(container, middlewares = []) {
63
+ this.configureServices();
64
+ const expressServer = new inversify_express_utils_1.InversifyExpressServer(container);
65
+ expressServer.setConfig((app) => {
66
+ /* Default body parser application/json */
67
+ app.use(express_1.default.json());
68
+ /* Default body parser application/x-www-form-urlencoded */
69
+ app.use(express_1.default.urlencoded({ extended: true }));
70
+ middlewares.forEach(middleware => {
71
+ app.use(middleware);
72
+ });
73
+ });
74
+ this.app = expressServer.build();
75
+ /* Add the error handler middleware */
76
+ this.app.use(error_handler_middleware_1.default);
77
+ return this;
78
+ }
79
+ /**
80
+ * Start listening on the given port and environment.
81
+ * @param port - The port number to listen on.
82
+ * @param environment - The server environment.
83
+ * @param consoleMessage - Optional message to display in the console.
84
+ */
85
+ listen(port, environment, consoleMessage) {
86
+ this.port = port;
87
+ this.environment = environment;
88
+ this.app.listen(this.port, () => {
89
+ new console_1.Console().messageServer(this.port, this.environment, consoleMessage);
90
+ process_1.default.on("SIGINT", this.serverShutdown.bind(this));
91
+ });
92
+ this.postServerInitialization();
93
+ }
94
+ };
95
+ Application = Application_1 = __decorate([
96
+ (0, inversify_binding_decorators_1.provide)(Application_1),
97
+ __metadata("design:paramtypes", [])
98
+ ], Application);
99
+ exports.Application = Application;
100
+ const appServerInstance = new Application();
101
+ exports.AppInstance = appServerInstance;
@@ -1,9 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppContainer = exports.ServerEnvironment = exports.Application = exports.AppInstance = void 0;
4
- var application_1 = require("./application");
5
- Object.defineProperty(exports, "AppInstance", { enumerable: true, get: function () { return application_1.AppInstance; } });
6
- Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return application_1.Application; } });
7
- Object.defineProperty(exports, "ServerEnvironment", { enumerable: true, get: function () { return application_1.ServerEnvironment; } });
8
- var app_container_1 = require("./app-container");
9
- Object.defineProperty(exports, "AppContainer", { enumerable: true, get: function () { return app_container_1.AppContainer; } });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppContainer = exports.ServerEnvironment = exports.Application = exports.AppInstance = void 0;
4
+ var application_1 = require("./application");
5
+ Object.defineProperty(exports, "AppInstance", { enumerable: true, get: function () { return application_1.AppInstance; } });
6
+ Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return application_1.Application; } });
7
+ Object.defineProperty(exports, "ServerEnvironment", { enumerable: true, get: function () { return application_1.ServerEnvironment; } });
8
+ var app_container_1 = require("./app-container");
9
+ Object.defineProperty(exports, "AppContainer", { enumerable: true, get: function () { return app_container_1.AppContainer; } });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });