web_api_base 1.0.0 → 1.0.1

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 (83) hide show
  1. package/dist/App.js +32 -0
  2. package/dist/App.js.map +1 -0
  3. package/dist/Application.d.ts +10 -0
  4. package/dist/Application.js +33 -0
  5. package/dist/Application.js.map +1 -0
  6. package/dist/ApplicationConfiguration.d.ts +10 -0
  7. package/dist/ApplicationConfiguration.js +69 -0
  8. package/dist/ApplicationConfiguration.js.map +1 -0
  9. package/dist/Configuration.js +69 -0
  10. package/dist/Configuration.js.map +1 -0
  11. package/dist/Index.js +2 -0
  12. package/dist/Index.js.map +1 -0
  13. package/dist/__tests__/classes/Controller.d.ts +8 -0
  14. package/dist/__tests__/classes/Controller.js +54 -0
  15. package/dist/__tests__/classes/Controller.js.map +1 -0
  16. package/dist/__tests__/decorators/controllers/ControllerDecorators.spec.d.ts +1 -0
  17. package/dist/__tests__/decorators/controllers/ControllerDecorators.spec.js +40 -0
  18. package/dist/__tests__/decorators/controllers/ControllerDecorators.spec.js.map +1 -0
  19. package/dist/config.json +1 -0
  20. package/dist/controllers/FileController.js +162 -0
  21. package/dist/controllers/FileController.js.map +1 -0
  22. package/dist/controllers/StatusController.js +44 -0
  23. package/dist/controllers/StatusController.js.map +1 -0
  24. package/dist/controllers/base/ControllerBase.d.ts +16 -0
  25. package/dist/controllers/base/ControllerBase.js +79 -0
  26. package/dist/controllers/base/ControllerBase.js.map +1 -0
  27. package/dist/decorators/controllers/ControllerDecorators.d.ts +36 -0
  28. package/dist/decorators/controllers/ControllerDecorators.js +104 -0
  29. package/dist/decorators/controllers/ControllerDecorators.js.map +1 -0
  30. package/dist/dependencyInjection/DependecyService.d.ts +9 -0
  31. package/dist/dependencyInjection/DependecyService.js +23 -0
  32. package/dist/dependencyInjection/DependecyService.js.map +1 -0
  33. package/dist/enums/httpVerbs/HttpVerbs.d.ts +6 -0
  34. package/dist/enums/httpVerbs/HttpVerbs.js +11 -0
  35. package/dist/enums/httpVerbs/HttpVerbs.js.map +1 -0
  36. package/dist/index.d.ts +0 -0
  37. package/dist/interfaces/IApplication.d.ts +7 -0
  38. package/dist/interfaces/IApplication.js +3 -0
  39. package/dist/interfaces/IApplication.js.map +1 -0
  40. package/dist/interfaces/IApplicationConfiguration.d.ts +5 -0
  41. package/dist/interfaces/IApplicationConfiguration.js +3 -0
  42. package/dist/interfaces/IApplicationConfiguration.js.map +1 -0
  43. package/dist/interfaces/IController.d.ts +5 -0
  44. package/dist/interfaces/IController.js +3 -0
  45. package/dist/interfaces/IController.js.map +1 -0
  46. package/dist/interfaces/entities/IDirectory.d.ts +5 -0
  47. package/dist/interfaces/entities/IDirectory.js +3 -0
  48. package/dist/interfaces/entities/IDirectory.js.map +1 -0
  49. package/dist/jest.config.d.ts +0 -0
  50. package/dist/jest.config.js +8 -0
  51. package/dist/jest.config.js.map +1 -0
  52. package/dist/midlewares/IMidleware.d.ts +4 -0
  53. package/dist/midlewares/IMidleware.js +3 -0
  54. package/dist/midlewares/IMidleware.js.map +1 -0
  55. package/dist/services/FileService.js +45 -0
  56. package/dist/services/FileService.js.map +1 -0
  57. package/dist/services/IFileService.js +8 -0
  58. package/dist/services/IFileService.js.map +1 -0
  59. package/dist/services/fileService/FileService.d.ts +10 -0
  60. package/dist/services/fileService/FileService.js +96 -0
  61. package/dist/services/fileService/FileService.js.map +1 -0
  62. package/dist/services/fileService/FileServiceBase.d.ts +10 -0
  63. package/dist/services/fileService/FileServiceBase.js +7 -0
  64. package/dist/services/fileService/FileServiceBase.js.map +1 -0
  65. package/package.json +7 -3
  66. package/.vscode/launch.json +0 -21
  67. package/Application.ts +0 -39
  68. package/ApplicationConfiguration.ts +0 -82
  69. package/__tests__/classes/Controller.ts +0 -38
  70. package/__tests__/decorators/controllers/ControllerDecorators.spec.ts +0 -67
  71. package/controllers/base/ControllerBase.ts +0 -116
  72. package/decorators/controllers/ControllerDecorators.ts +0 -187
  73. package/dependencyInjection/DependecyService.ts +0 -36
  74. package/enums/httpVerbs/HttpVerbs.ts +0 -7
  75. package/interfaces/IApplication.ts +0 -13
  76. package/interfaces/IApplicationConfiguration.ts +0 -6
  77. package/interfaces/IController.ts +0 -8
  78. package/interfaces/entities/IDirectory.ts +0 -6
  79. package/jest.config.ts +0 -6
  80. package/midlewares/IMidleware.ts +0 -6
  81. package/services/fileService/FileService.ts +0 -125
  82. package/services/fileService/FileServiceBase.ts +0 -16
  83. package/tsconfig.json +0 -103
@@ -1,21 +0,0 @@
1
- {
2
- // Use IntelliSense to learn about possible attributes.
3
- // Hover to view descriptions of existing attributes.
4
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
- "version": "0.2.0",
6
- "configurations": [
7
-
8
- {
9
- "type": "node",
10
- "request": "launch",
11
- "name": "Launch Program",
12
- "skipFiles": [
13
- "<node_internals>/**"
14
- ],
15
- "program": "${file}",
16
- "outFiles": [
17
- "${workspaceFolder}/**/*.js"
18
- ]
19
- }
20
- ]
21
- }
package/Application.ts DELETED
@@ -1,39 +0,0 @@
1
- import { Express } from "express";
2
- import ExpressModule from "express";
3
- import ApplicationConfiguration from "./ApplicationConfiguration"
4
- import IApplication from "./interfaces/IApplication";
5
- import IApplicationConfiguration from "./interfaces/IApplicationConfiguration";
6
-
7
- export default abstract class Application implements IApplication
8
- {
9
-
10
- private ApplicationConfiguration : IApplicationConfiguration;
11
-
12
- public Express : Express;
13
-
14
-
15
- constructor()
16
- {
17
- this.ApplicationConfiguration = new ApplicationConfiguration();
18
-
19
- this.Express = ExpressModule();
20
-
21
- }
22
-
23
-
24
- public async StartAsync() : Promise<void>
25
- {
26
- await this.ApplicationConfiguration.StartAsync();
27
-
28
- this.Configure(this.ApplicationConfiguration);
29
-
30
- this.Express.listen(this.ApplicationConfiguration.Port, this.ApplicationConfiguration.Host, ()=>
31
- {
32
- console.log(`App running on ${this.ApplicationConfiguration.Host}:${this.ApplicationConfiguration.Port}`);
33
- })
34
- }
35
-
36
- public abstract Configure(appConfig : IApplicationConfiguration): void;
37
-
38
-
39
- }
@@ -1,82 +0,0 @@
1
- import File from 'fs';
2
-
3
- import IApplicationConfiguration from './interfaces/IApplicationConfiguration';
4
-
5
-
6
- export default class Configuration implements IApplicationConfiguration
7
- {
8
-
9
- public Host : string = "0.0.0.0";
10
- public Port : number = 5555;
11
-
12
- constructor()
13
- {
14
- process.env["root_dir"] = __dirname;
15
- }
16
-
17
- public async StartAsync() : Promise<void>
18
- {
19
- if(!await this.CheckFileAsync())
20
- {
21
- await this.CreateFileAsync();
22
-
23
- }else{
24
-
25
- await this.ReadFileAsync();
26
- }
27
- }
28
-
29
- private async CheckFileAsync() : Promise<boolean>
30
- {
31
- return new Promise<boolean>((resolve, _) => resolve(File.existsSync(`${__dirname}\\config.json`)));
32
- }
33
-
34
- private async ReadFileAsync() : Promise<boolean>
35
- {
36
- return new Promise<boolean>((resolve, _) =>
37
- {
38
- File.readFile(`${__dirname}\\config.json`, 'utf-8', (error, data) =>
39
- {
40
- if(error)
41
- {
42
- throw error;
43
- }
44
-
45
- let json : any = JSON.parse(data);
46
-
47
- for(let key in this)
48
- {
49
- if(json[key] != undefined)
50
- {
51
- this[key] = json[key];
52
- }
53
- }
54
-
55
- resolve(true);
56
-
57
- })
58
- })
59
- }
60
-
61
- private async CreateFileAsync() : Promise<boolean>
62
- {
63
-
64
- return new Promise<boolean>((resolve, _)=>{
65
-
66
- File.writeFile(`${__dirname}\\config.json`, JSON.stringify(this), 'utf-8', error =>
67
- {
68
-
69
- if(error)
70
- {
71
- throw error;
72
- }
73
-
74
- resolve(true);
75
-
76
- });
77
- })
78
-
79
- }
80
-
81
- }
82
-
@@ -1,38 +0,0 @@
1
- /* istanbul ignore next */
2
-
3
- import { ControllerBase } from "../../controllers/base/ControllerBase";
4
- import ControllersDecorators from "../../decorators/controllers/ControllerDecorators";
5
- import { HTTPVerbs } from "../../enums/httpVerbs/HttpVerbs";
6
- import IApplication from "../../interfaces/IApplication";
7
- import {Request, Response} from 'express'
8
-
9
- @ControllersDecorators.Route("/test")
10
- export class ControllerTest extends ControllerBase
11
- {
12
- constructor()
13
- {
14
- super();
15
- }
16
-
17
- @ControllersDecorators.Action("Test")
18
- @ControllersDecorators.Verb(HTTPVerbs.GET)
19
- @ControllersDecorators.Argument<string>('name')
20
- public TestAction(name : string)
21
- {
22
- console.log(name);
23
- }
24
-
25
- @ControllersDecorators.Action("Test")
26
- @ControllersDecorators.Verb(HTTPVerbs.GET)
27
- @ControllersDecorators.Argument<string, number>('name', 'age')
28
- public TestActionTwo(name : string, age : number)
29
- {
30
- console.log(name, age);
31
- }
32
-
33
-
34
- public AppendSync(application: IApplication): void
35
- {
36
-
37
- }
38
- }
@@ -1,67 +0,0 @@
1
- import { ControllerTest } from "../../classes/Controller";
2
- import ControllersDecorators from "../../../decorators/controllers/ControllerDecorators";
3
- import { HTTPVerbs } from "../../../enums/httpVerbs/HttpVerbs";
4
-
5
- describe('testing controllers decorators', ()=>
6
- {
7
-
8
- test("action name", ()=>
9
- {
10
- var controller = new ControllerTest();
11
- let action = ControllersDecorators.GetAction(controller, "TestAction");
12
- expect(action).toBe("Test");
13
-
14
- },10^5)
15
-
16
- test("http verb", ()=>
17
- {
18
- var controller = new ControllerTest();
19
- let verb = ControllersDecorators.GetVerb(controller, "TestAction");
20
- expect(verb).toBe(HTTPVerbs.GET);
21
-
22
- },10^5)
23
-
24
- test("action with one arg", ()=>
25
- {
26
- var controller = new ControllerTest();
27
-
28
- var handler = ControllersDecorators.GetArgumentsHandler(controller, 'TestAction');
29
-
30
- var arr = handler?.CreateArgumentsList({name : "adriano"});
31
-
32
- Reflect.apply(controller.TestAction, controller, arr ?? []);
33
-
34
- expect(arr).not.toBeNull();
35
-
36
-
37
- },10^5)
38
-
39
-
40
- test("action with two args", ()=>
41
- {
42
- var controller = new ControllerTest();
43
-
44
- var handler = ControllersDecorators.GetArgumentsHandler(controller, 'TestActionTwo');
45
-
46
- var arr = handler?.CreateArgumentsList({name : "adriano", age : 30});
47
-
48
- Reflect.apply(controller.TestActionTwo, controller, arr ?? []);
49
-
50
- expect(arr).not.toBeNull();
51
-
52
-
53
- },10^5)
54
-
55
-
56
- test("controller route", ()=>
57
- {
58
- var controller = new ControllerTest();
59
-
60
- var route = ControllersDecorators.GetRoute(controller);
61
-
62
- expect(route!).toBe("/test");
63
-
64
-
65
- },10^5)
66
-
67
- })
@@ -1,116 +0,0 @@
1
- import IController from "../../interfaces/IController";
2
- import {Request, Response} from 'express'
3
- import ControllersDecorators from '../../decorators/controllers/ControllerDecorators';
4
- import DependecyService from '../../dependencyInjection/DependecyService';
5
- import IApplication from "../../interfaces/IApplication";
6
- import { HTTPVerbs } from "../../enums/httpVerbs/HttpVerbs";
7
-
8
-
9
- export class ControllerBase implements IController
10
- {
11
- Request : Request = {} as Request;
12
- Response : Response = {} as Response;
13
-
14
- constructor()
15
- {
16
-
17
- }
18
-
19
- public OK<T>(result : T)
20
- {
21
- this.Response.status(200);
22
- this.Response.json(result);
23
- }
24
-
25
- public Created()
26
- {
27
- this.Response.status(201);
28
- this.Response.end();
29
- }
30
-
31
- public BadRequest<T>(result : T)
32
- {
33
- this.Response.status(400);
34
- this.Response.json(result);
35
- }
36
-
37
- public Error<T>(result : T)
38
- {
39
- this.Response.status(500);
40
- this.Response.json(result);
41
- }
42
-
43
- public SendResponse<T>(status : number, result : T)
44
- {
45
- this.Response.status(status);
46
- this.Response.json(result);
47
- }
48
-
49
- public static AppendController<T extends IController>(ctor : { new (...args : any[]) : T;}, application : IApplication) : void
50
- {
51
- let empty = new ctor() as any;
52
-
53
- let methods = Reflect.ownKeys(empty.constructor.prototype).filter(m =>
54
- {
55
- return typeof empty[m] == "function" ;
56
- })
57
-
58
- let route = ControllersDecorators.GetRoute(empty);
59
-
60
- if(!route)
61
- return;
62
-
63
-
64
- for(let method of methods)
65
- {
66
- let action = ControllersDecorators.GetAction(empty, method.toString());
67
-
68
- if(!action){
69
- continue;
70
- }
71
-
72
- let verb = ControllersDecorators.GetVerb(empty, method.toString());
73
-
74
- if(!verb)
75
- verb = HTTPVerbs.GET;
76
-
77
- console.debug("appended : " , verb,`${route}${action}`);
78
-
79
- (application.Express as any)[verb.toString().toLowerCase()](`${route}${action}`, (req : Request, resp : Response) =>
80
- {
81
-
82
- let midlewares = ControllersDecorators.GetMidlewares(empty).reverse();
83
-
84
- midlewares.push(...ControllersDecorators.GetBefores(empty, method.toString()).reverse());
85
-
86
- if(midlewares)
87
- {
88
- for(let method of midlewares)
89
- {
90
- method(req);
91
- }
92
- }
93
-
94
- let args = ControllersDecorators.GetArgumentsHandler(empty, method.toString());
95
- let params = [];
96
-
97
- if(args)
98
- {
99
- if(args.Arguments.length > 0)
100
- {
101
- if(req.body && verb == (HTTPVerbs.POST || verb == HTTPVerbs.PUT))
102
- params = args.CreateArgumentsList(req.body);
103
- if(req.query)
104
- params.push(...args.CreateArgumentsList(req.query))
105
- }
106
- }
107
-
108
- let controller = DependecyService.ResolveCtor(empty.constructor) as IController;
109
- controller.Request = req;
110
- controller.Response = resp;
111
- (controller as any)[method](...params);
112
- })
113
- }
114
-
115
- }
116
- }
@@ -1,187 +0,0 @@
1
- import { REFUSED } from 'dns';
2
- import 'reflect-metadata';
3
-
4
- import { HTTPVerbs } from '../../enums/httpVerbs/HttpVerbs';
5
- import IController from '../../interfaces/IController';
6
- import IMidleware from '../../midlewares/IMidleware';
7
-
8
- export default class ControllersDecorators
9
- {
10
- constructor()
11
- {
12
-
13
- }
14
-
15
- private static RouteKeyMetadata = "meta:controllerRoute";
16
- private static ActionVerbKeyMetadata = "meta:actionVerb";
17
- private static ActionNameKeyMetadata = "meta:actionName";
18
- private static ArgumentsHandlerKeyMetadata = "meta:argHandler";
19
- private static ControllerMidlewaresKeyMetadata = "meta:controllerMidlewaresKey";
20
- private static ActionsMidlewaresKeyMetadata = "meta:actionMidlewaresKey";
21
-
22
-
23
- public static Route(route : string)
24
- {
25
- return function( target : Function)
26
- {
27
- Reflect.defineMetadata(ControllersDecorators.RouteKeyMetadata, route, target);
28
-
29
- }
30
- }
31
-
32
- public static Use(midleware : IMidleware)
33
- {
34
- return function( target : Function)
35
- {
36
- let current : IMidleware[] = Reflect.getMetadata(ControllersDecorators.ControllerMidlewaresKeyMetadata, target) ?? [];
37
-
38
- current.push(midleware);
39
-
40
- Reflect.defineMetadata(ControllersDecorators.ControllerMidlewaresKeyMetadata, current, target);
41
- }
42
- }
43
-
44
- public static GetMidlewares(controller : IController) : IMidleware[]
45
- {
46
- return Reflect.getMetadata(ControllersDecorators.ControllerMidlewaresKeyMetadata, controller.constructor) ?? [];
47
- }
48
-
49
- public static Before(midleware : IMidleware)
50
- {
51
- return function( target : Object, methodName : string, propertyDescriptor : PropertyDescriptor)
52
- {
53
- let current : IMidleware[] = Reflect.getMetadata(ControllersDecorators.ActionsMidlewaresKeyMetadata, target, methodName) ?? [];
54
-
55
- current.push(midleware);
56
-
57
- ControllersDecorators.SetMetaData(ControllersDecorators.ActionsMidlewaresKeyMetadata, target, methodName, current);
58
-
59
- }
60
- }
61
-
62
- public static GetBefores(controller : IController, methodName : string) : IMidleware[]
63
- {
64
- return this.GetMetaData<IMidleware[]>(ControllersDecorators.ActionsMidlewaresKeyMetadata, controller, methodName) ?? [];
65
- }
66
-
67
- public static GetRoute(controller : IController) : string | undefined
68
- {
69
- return Reflect.getMetadata(ControllersDecorators.RouteKeyMetadata, controller.constructor);
70
- }
71
-
72
-
73
- public static Verb(verb : HTTPVerbs)
74
- {
75
- return function( target : Object, methodName : string, propertyDescriptor : PropertyDescriptor)
76
- {
77
- ControllersDecorators.SetMetaData(ControllersDecorators.ActionVerbKeyMetadata, target, methodName, verb);
78
-
79
- }
80
- }
81
-
82
- public static GetVerb(target : IController, methodName : string ) : HTTPVerbs | undefined
83
- {
84
- let meta = this.GetMetaData<HTTPVerbs>(ControllersDecorators.ActionVerbKeyMetadata, target, methodName);
85
-
86
- return meta;
87
- }
88
-
89
- public static Action(actionName : String)
90
- {
91
- return function( target : Object, methodName : string, propertyDescriptor : PropertyDescriptor)
92
- {
93
- ControllersDecorators.SetMetaData(ControllersDecorators.ActionNameKeyMetadata, target, methodName, actionName);
94
-
95
- }
96
- }
97
-
98
- public static GetAction(target : IController, methodName : string ) : string | undefined
99
- {
100
- let meta = this.GetMetaData<string>(ControllersDecorators.ActionNameKeyMetadata, target, methodName);
101
-
102
- return meta;
103
- }
104
-
105
-
106
- public static Argument<T>(argName1 : string) : ( target : Object, methodName : string, propertyDescriptor : PropertyDescriptor) => void
107
- public static Argument<T, U>(argName1 : string, argName2?: string) : ( target : Object, methodName : string, propertyDescriptor : PropertyDescriptor) => void
108
- public static Argument<T, U, K>(argName1 : string, argName2?: string, argName3? : string) : ( target : Object, methodName : string, propertyDescriptor : PropertyDescriptor) => void
109
- public static Argument<T, U, K, Y>(argName1 : string, argName2?: string, argName3? : string, argName4? : string) : ( target : Object, methodName : string, propertyDescriptor : PropertyDescriptor) => void
110
- public static Argument<T, U, K, Y, J>(argName1 : string, argName2?: string, argName3? : string, argName4? : string, argName5? : string) : ( target : Object, methodName : string, propertyDescriptor : PropertyDescriptor) => void
111
- public static Argument<T, U, K, Y, J, V>(argName1 : string, argName2?: string, argName3? : string, argName4? : string, argName5? : string, argName6? : string) : ( target : Object, methodName : string, propertyDescriptor : PropertyDescriptor) => void
112
- {
113
- return function( target : Object, methodName : string, propertyDescriptor : PropertyDescriptor)
114
- {
115
- ControllersDecorators.SetMetaData(ControllersDecorators.ArgumentsHandlerKeyMetadata, target, methodName,
116
- {
117
-
118
-
119
- Arguments : [argName1, argName2, argName3, argName4, argName5, argName6],
120
-
121
- CreateArgumentsList : (args : any) =>
122
- {
123
- let results = [] as any[];
124
-
125
-
126
- if (argName1 && (args[argName1] as unknown as T) != undefined)
127
- results[0] = args[argName1] as T;
128
-
129
- if (argName2 && (args[argName2] as unknown as U) != undefined)
130
- results[1] = args[argName2] as U;
131
-
132
- if (argName3 && (args[argName3] as unknown as K) != undefined)
133
- results[2] = args[argName3] as K;
134
-
135
- if (argName4 && (args[argName4] as unknown as Y) != undefined)
136
- results[3] = args[argName4] as Y;
137
-
138
- if (argName5 && (args[argName5] as unknown as J) != undefined)
139
- results[4] = args[argName5] as J;
140
-
141
- if (argName6 && (args[argName6] as unknown as V) != undefined)
142
- results[5] = args[argName6] as V;
143
-
144
- return results;
145
-
146
- }
147
- });
148
-
149
- }
150
- }
151
-
152
-
153
-
154
- public static GetArgumentsHandler(target : IController, methodName : string ) : IArgumentResolverHandler | undefined
155
- {
156
- let handler = this.GetMetaData<IArgumentResolverHandler>(ControllersDecorators.ArgumentsHandlerKeyMetadata, target, methodName);
157
-
158
- return handler;
159
- }
160
-
161
- private static SetMetaData<T>(key: string, target : Object, methodName : string, value : T)
162
- {
163
- var meta = Reflect.getOwnMetadata(key, target as Object, methodName);
164
-
165
- if(!meta)
166
- Reflect.defineMetadata(key, value, target as Object, methodName);
167
- }
168
-
169
-
170
- private static GetMetaData<T>(key: string, target : Object, methodName : string) : T | undefined
171
- {
172
- var meta = Reflect.getMetadata(key, target, methodName);
173
-
174
- if(meta != undefined)
175
- return meta as T;
176
- else
177
- return undefined;
178
- }
179
-
180
- }
181
- interface IArgumentResolverHandler
182
- {
183
- Arguments : string[];
184
- CreateArgumentsList : (args :any) => any[];
185
- }
186
-
187
-
@@ -1,36 +0,0 @@
1
- export default class DependecyService
2
- {
3
- private static _services : IService[] = [];
4
-
5
- public static RegisterFor(type : Function, ctor : { new (...args : any[]) : any;}, builder? : () => any) : void
6
- {
7
- let defaultBuilder = () => Reflect.construct(ctor ?? type, []) as any;
8
-
9
- this._services.push({ Type : type, Builder : builder ?? defaultBuilder });
10
- }
11
-
12
- public static Register(type : Function, builder? : () => any) : void
13
- {
14
- let defaultBuilder = () => Reflect.construct(type, []);
15
-
16
- this._services.push({ Type : type, Builder : builder ?? defaultBuilder });
17
- }
18
-
19
- public static Resolve<T>(type : Function, args? : any[]) : T
20
- {
21
- return this._services.find(u => u.Type == type)?.Builder(args) as T;
22
- }
23
-
24
- public static ResolveCtor(ctor : Function, args? : any[]) : any
25
- {
26
- return this._services.find(u => u.Type == ctor)?.Builder(args);
27
- }
28
-
29
- }
30
-
31
-
32
- interface IService
33
- {
34
- Type : Function;
35
- Builder : Function;
36
- }
@@ -1,7 +0,0 @@
1
- export enum HTTPVerbs
2
- {
3
- GET = "GET",
4
- POST = "POST",
5
- PUT = "PUT",
6
- DELETE = "DELETE"
7
- }
@@ -1,13 +0,0 @@
1
- import { Express } from "express";
2
- import IApplicationConfiguration from './IApplicationConfiguration';
3
-
4
- import IController from "./IController";
5
-
6
- export default interface IApplication
7
- {
8
- Express : Express;
9
-
10
- StartAsync() : Promise<void>;
11
-
12
- Configure(appConfig : IApplicationConfiguration): void;
13
- }
@@ -1,6 +0,0 @@
1
- export default interface IApplicationConfiguration
2
- {
3
- Host : string;
4
- Port : number;
5
- StartAsync() : Promise<void>
6
- }
@@ -1,8 +0,0 @@
1
- import IApplication from "./IApplication";
2
- import {Request, Response} from 'express'
3
-
4
- export default interface IController
5
- {
6
- Request : Request;
7
- Response : Response;
8
- }
@@ -1,6 +0,0 @@
1
- export interface IDirectory
2
- {
3
- Path : string;
4
- SubDirectories? : string[],
5
- Files? : string[]
6
- }
package/jest.config.ts DELETED
@@ -1,6 +0,0 @@
1
- /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2
- module.exports = {
3
- preset: 'ts-jest',
4
- testEnvironment: 'node',
5
- modulePathIgnorePatterns: ['<rootDir>/__test__/classes/'],
6
- };
@@ -1,6 +0,0 @@
1
- import { Request } from "express";
2
-
3
- export default interface IMidleware
4
- {
5
- (req : Request) : void
6
- }