1 | import {APIEndpoint, APIParameter} from "../APILove";
|
2 |
|
3 | export class SampleAPI {
|
4 |
|
5 | blah = "yo!sddf";
|
6 |
|
7 | ({
|
8 | method: "POST",
|
9 | path: "/foo/:what"
|
10 | })
|
11 | static staticFunc(
|
12 | what: string, // This will be retrieved as a string from the URL
|
13 | ({
|
14 | optional: true
|
15 | })
|
16 | data:any, // The body will be parsed and sent back here
|
17 | req?, // Access the raw express.js request
|
18 | res? // Access the raw express.js response
|
19 | ): Promise<any> {
|
20 |
|
21 | return new Promise<any>((resolve, reject) => {
|
22 | resolve(data);
|
23 | });
|
24 | }
|
25 |
|
26 | @APIEndpoint({
|
27 | method: "POST",
|
28 | path: "/foo/:what"
|
29 | })
|
30 | instanceFunc(
|
31 | @APIParameter({
|
32 | optional: true
|
33 | })
|
34 | what: string, // This will be retrieved as a string from the URL
|
35 | data:any, // The body will be parsed and sent back here
|
36 | req?, // Access the raw express.js request
|
37 | res? // Access the raw express.js response
|
38 | ): Promise<any> {
|
39 |
|
40 | return new Promise<any>((resolve, reject) => {
|
41 | resolve(data);
|
42 | });
|
43 | }
|
44 | } |
\ | No newline at end of file |