UNPKG

2.56 kBJavaScriptView Raw
1"use strict";
2var __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};
8var __metadata = (this && this.__metadata) || function (k, v) {
9 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10};
11var __param = (this && this.__param) || function (paramIndex, decorator) {
12 return function (target, key) { decorator(target, key, paramIndex); }
13};
14Object.defineProperty(exports, "__esModule", { value: true });
15const APILove_1 = require("../APILove");
16class SampleAPI {
17 constructor() {
18 this.blah = "yo!sddf";
19 }
20 static staticFunc(what, // This will be retrieved as a string from the URL
21 data, // The body will be parsed and sent back here
22 req, // Access the raw express.js request
23 res // Access the raw express.js response
24 ) {
25 return new Promise((resolve, reject) => {
26 resolve(data);
27 });
28 }
29 instanceFunc(what, // This will be retrieved as a string from the URL
30 data, // The body will be parsed and sent back here
31 req, // Access the raw express.js request
32 res // Access the raw express.js response
33 ) {
34 return new Promise((resolve, reject) => {
35 resolve(data);
36 });
37 }
38}
39__decorate([
40 APILove_1.APIEndpoint({
41 method: "POST",
42 path: "/foo/:what"
43 }),
44 __param(0, APILove_1.APIParameter({
45 optional: true
46 })),
47 __metadata("design:type", Function),
48 __metadata("design:paramtypes", [String, Object, Object, Object]),
49 __metadata("design:returntype", Promise)
50], SampleAPI.prototype, "instanceFunc", null);
51__decorate([
52 APILove_1.APIEndpoint({
53 method: "POST",
54 path: "/foo/:what"
55 }),
56 __param(1, APILove_1.APIParameter({
57 optional: true
58 })),
59 __metadata("design:type", Function),
60 __metadata("design:paramtypes", [String, Object, Object, Object]),
61 __metadata("design:returntype", Promise)
62], SampleAPI, "staticFunc", null);
63exports.SampleAPI = SampleAPI;
64//# sourceMappingURL=SampleAPI.js.map
\No newline at end of file