-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
Get.ts
30 lines (27 loc) · 943 Bytes
/
Get.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { getMetadataArgsStorage } from "../mod.ts";
import { RequestMethod } from "../types/request-method.ts";
/**
* Registers an action to be executed when GET request comes on a given route.
* Must be applied on a controller action.
*/
export function Get(route?: RegExp): Function;
/**
* Registers an action to be executed when GET request comes on a given route.
* Must be applied on a controller action.
*/
export function Get(route?: string): Function;
/**
* Registers an action to be executed when GET request comes on a given route.
* Must be applied on a controller action.
*/
export function Get(route?: string|RegExp): Function {
return function (object: Object, methodName: string) {
getMetadataArgsStorage().actions.push({
type: RequestMethod.Get,
object: object,
target: object.constructor,
method: methodName,
route: route
});
};
}