web_api_base 2.3.3 → 2.5.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.
- package/dist/Index.js +31 -1
- package/dist/Index.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/temp/Application.js.map +1 -1
- package/dist/temp/controllers/StatusController.js.map +1 -1
- package/package.json +1 -1
- package/readme.md +17 -6
package/dist/Index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DependecyService = exports.HTTPVerbs = exports.ControllerBase = exports.ControllersDecorators = exports.ApplicationConfiguration = exports.Application = void 0;
|
|
6
|
+
exports.Argument = exports.Verb = exports.Route = exports.Action = exports.Run = exports.Use = exports.DependecyService = exports.HTTPVerbs = exports.ControllerBase = exports.ControllersDecorators = exports.ApplicationConfiguration = exports.Application = void 0;
|
|
7
7
|
var Application_1 = require("./Application");
|
|
8
8
|
Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return __importDefault(Application_1).default; } });
|
|
9
9
|
var ApplicationConfiguration_1 = require("./ApplicationConfiguration");
|
|
@@ -16,4 +16,34 @@ var HttpVerbs_1 = require("./enums/httpVerbs/HttpVerbs");
|
|
|
16
16
|
Object.defineProperty(exports, "HTTPVerbs", { enumerable: true, get: function () { return HttpVerbs_1.HTTPVerbs; } });
|
|
17
17
|
var DependecyService_1 = require("./dependencyInjection/DependecyService");
|
|
18
18
|
Object.defineProperty(exports, "DependecyService", { enumerable: true, get: function () { return __importDefault(DependecyService_1).default; } });
|
|
19
|
+
const ControllerDecorators_2 = __importDefault(require("./decorators/controllers/ControllerDecorators"));
|
|
20
|
+
function Use(midleware) {
|
|
21
|
+
return ControllerDecorators_2.default.Use(midleware);
|
|
22
|
+
}
|
|
23
|
+
exports.Use = Use;
|
|
24
|
+
;
|
|
25
|
+
function Run(midleware) {
|
|
26
|
+
return ControllerDecorators_2.default.Before(midleware);
|
|
27
|
+
}
|
|
28
|
+
exports.Run = Run;
|
|
29
|
+
;
|
|
30
|
+
function Action(actionName) {
|
|
31
|
+
return ControllerDecorators_2.default.Action(actionName);
|
|
32
|
+
}
|
|
33
|
+
exports.Action = Action;
|
|
34
|
+
;
|
|
35
|
+
function Route(route) {
|
|
36
|
+
return ControllerDecorators_2.default.Route(route);
|
|
37
|
+
}
|
|
38
|
+
exports.Route = Route;
|
|
39
|
+
;
|
|
40
|
+
function Verb(verb) {
|
|
41
|
+
return ControllerDecorators_2.default.Verb(verb);
|
|
42
|
+
}
|
|
43
|
+
exports.Verb = Verb;
|
|
44
|
+
;
|
|
45
|
+
function Argument(argName1, argName2, argName3, argName4, argName5) {
|
|
46
|
+
return ControllerDecorators_2.default.Argument(argName1, argName2, argName3, argName4, argName5);
|
|
47
|
+
}
|
|
48
|
+
exports.Argument = Argument;
|
|
19
49
|
//# sourceMappingURL=index.js.map
|
package/dist/Index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAsD;AAA7C,2HAAA,OAAO,OAAe;AAC/B,uEAAiF;AAAxE,qJAAA,OAAO,OAA4B;AAE5C,sFAAiG;AAAxF,8IAAA,OAAO,OAAyB;AACzC,oEAAmE;AAA1D,gHAAA,cAAc,OAAA;AAEvB,yDAAwD;AAA/C,sGAAA,SAAS,OAAA;AAElB,2EAAqF;AAA5E,qIAAA,OAAO,OAAoB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAsD;AAA7C,2HAAA,OAAO,OAAe;AAC/B,uEAAiF;AAAxE,qJAAA,OAAO,OAA4B;AAE5C,sFAAiG;AAAxF,8IAAA,OAAO,OAAyB;AACzC,oEAAmE;AAA1D,gHAAA,cAAc,OAAA;AAEvB,yDAAwD;AAA/C,sGAAA,SAAS,OAAA;AAElB,2EAAqF;AAA5E,qIAAA,OAAO,OAAoB;AAQpC,yGAAkF;AAIlF,SAAgB,GAAG,CAAC,SAAsB;IAEtC,OAAO,8BAAqB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAChD,CAAC;AAHD,kBAGC;AAAC,CAAC;AAEH,SAAgB,GAAG,CAAC,SAAsB;IAEtC,OAAO,8BAAqB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACnD,CAAC;AAHD,kBAGC;AAAC,CAAC;AAEH,SAAgB,MAAM,CAAC,UAAmB;IAEtC,OAAO,8BAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACpD,CAAC;AAHD,wBAGC;AAAC,CAAC;AAEH,SAAgB,KAAK,CAAC,KAAc;IAEhC,OAAO,8BAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC;AAHD,sBAGC;AAAC,CAAC;AAGH,SAAgB,IAAI,CAAC,IAAgB;IAEjC,OAAO,8BAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAHD,oBAGC;AAAC,CAAC;AAMH,SAAgB,QAAQ,CAAiB,QAAiB,EAAE,QAAkB,EAAE,QAAkB,EAAE,QAAkB,EAAE,QAAkB;IAEtI,OAAO,8BAAqB,CAAC,QAAQ,CAAiB,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC5G,CAAC;AAHD,4BAGC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,3 +8,14 @@ export { default as IMidleware } from './midlewares/IMidleware';
|
|
|
8
8
|
export { default as IApplicationConfiguration } from "./interfaces/IApplicationConfiguration";
|
|
9
9
|
export { default as IApplication } from "./interfaces/IApplication";
|
|
10
10
|
export { default as IApplicatiIControllernConfiguration } from "./interfaces/IController";
|
|
11
|
+
import { HTTPVerbs } from "./enums/httpVerbs/HttpVerbs";
|
|
12
|
+
import IMidleware from "./midlewares/IMidleware";
|
|
13
|
+
export declare function Use(midleware: IMidleware): (target: Function) => void;
|
|
14
|
+
export declare function Run(midleware: IMidleware): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
15
|
+
export declare function Action(actionName: String): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
16
|
+
export declare function Route(route: string): (target: Function) => void;
|
|
17
|
+
export declare function Verb(verb: HTTPVerbs): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
18
|
+
export declare function Argument<T>(argName1: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
19
|
+
export declare function Argument<T, U>(argName1: string, argName2?: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
20
|
+
export declare function Argument<T, U, K>(argName1: string, argName2?: string, argName3?: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
21
|
+
export declare function Argument<T, U, K, Y>(argName1: string, argName2?: string, argName3?: string, argName4?: string): (target: Object, methodName: string, propertyDescriptor: PropertyDescriptor) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Application.js","sourceRoot":"","sources":["../../temp/Application.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,sFAAgE;AAEhE,
|
|
1
|
+
{"version":3,"file":"Application.js","sourceRoot":"","sources":["../../temp/Application.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,sFAAgE;AAEhE,oCAAwF;AAMxF,MAAqB,GAAI,SAAQ,mBAAW;IAExC;QAEI,KAAK,EAAE,CAAC;IACZ,CAAC;IAEqB,cAAc,CAAC,SAAoC;;YAGrE,IAAI,CAAC,OAAO,EAAE,CAAC;YAEf,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;YAEvC,IAAI,CAAC,gBAAgB,CAAC,0BAAgB,CAAC,CAAC;QAE5C,CAAC;KAAA;IAGO,sBAAsB,CAAC,SAAoC;QAEhE,wBAAgB,CAAC,QAAQ,CAAC,0BAAgB,CAAC,CAAC;IAC/C,CAAC;CAGJ;AAzBD,sBAyBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusController.js","sourceRoot":"","sources":["../../../temp/controllers/StatusController.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"StatusController.js","sourceRoot":"","sources":["../../../temp/controllers/StatusController.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAAmG;AAInG,IAAqB,gBAAgB,GAArC,MAAqB,gBAAiB,SAAQ,sBAAc;IAGxD;QAEI,KAAK,EAAE,CAAC;IACZ,CAAC;IAIM,WAAW;QAEd,IAAI,CAAC,EAAE,CAAC,EAAC,MAAM,EAAG,IAAI,EAAC,CAAC,CAAA;IAC5B,CAAC;CAEJ,CAAA;AALG;IAFC,6BAAE,CAAC,IAAI,CAAC,iBAAK,CAAC,GAAG,CAAC;IAClB,6BAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;;;;mDAInB;AAbgB,gBAAgB;IADpC,6BAAE,CAAC,KAAK,CAAC,SAAS,CAAC;;GACC,gBAAgB,CAepC;kBAfoB,gBAAgB"}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -20,13 +20,22 @@ After that, we need to create some controllers and, they must inherit the abstr
|
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
22
|
|
|
23
|
-
import { ControllerBase,
|
|
23
|
+
import { ControllerBase, HTTPVerbs as verbs, Use, Verb, Route, Action } from "web_api_base";
|
|
24
|
+
/*
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
we can use this class to acess all decorators centralized
|
|
27
|
+
import { ControllerDecorators as CD } from "web_api_base";
|
|
28
|
+
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
//@CD.Route("/sample")
|
|
32
|
+
@Route("/sample")
|
|
26
33
|
export default class SampleController extends ControllerBase
|
|
27
34
|
{
|
|
28
|
-
|
|
29
|
-
@
|
|
35
|
+
//@CD.Verb(verbs.GET)
|
|
36
|
+
@Verb(verbs.GET)
|
|
37
|
+
//@CD.Action("/hello")
|
|
38
|
+
@Action("/hello")
|
|
30
39
|
public Hello() : void
|
|
31
40
|
{
|
|
32
41
|
this.OK({message: "Hello Word!"})
|
|
@@ -48,8 +57,10 @@ export default class App extends Application
|
|
|
48
57
|
|
|
49
58
|
public override Configure(appConfig: IApplicationConfiguration): void
|
|
50
59
|
{
|
|
51
|
-
|
|
52
|
-
appConfig.
|
|
60
|
+
//to define the host use this property, if that property is not changed, the default value will be 0.0.0.0
|
|
61
|
+
appConfig.Host = "127.0.0.1";
|
|
62
|
+
//to define the app port use this property, if that property is not changed, the default value will be 5555
|
|
63
|
+
appConfig.Port = 1234;
|
|
53
64
|
|
|
54
65
|
//allow CORS
|
|
55
66
|
this.UseCors();
|