@nmshd/typescript-rest 3.0.5

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 (62) hide show
  1. package/.ci/runChecks.sh +7 -0
  2. package/.eslintrc.js +226 -0
  3. package/.github/dependabot.yml +27 -0
  4. package/.github/workflows/publish.yml +33 -0
  5. package/.github/workflows/test.yml +31 -0
  6. package/.prettierrc +27 -0
  7. package/.vscode/settings.json +31 -0
  8. package/LICENSE +22 -0
  9. package/README.md +128 -0
  10. package/dist/decorators/methods.d.ts +165 -0
  11. package/dist/decorators/methods.js +263 -0
  12. package/dist/decorators/methods.js.map +1 -0
  13. package/dist/decorators/parameters.d.ts +295 -0
  14. package/dist/decorators/parameters.js +423 -0
  15. package/dist/decorators/parameters.js.map +1 -0
  16. package/dist/decorators/services.d.ts +199 -0
  17. package/dist/decorators/services.js +367 -0
  18. package/dist/decorators/services.js.map +1 -0
  19. package/dist/server/config.d.ts +4 -0
  20. package/dist/server/config.js +43 -0
  21. package/dist/server/config.js.map +1 -0
  22. package/dist/server/model/errors.d.ts +111 -0
  23. package/dist/server/model/errors.js +178 -0
  24. package/dist/server/model/errors.js.map +1 -0
  25. package/dist/server/model/metadata.d.ts +91 -0
  26. package/dist/server/model/metadata.js +80 -0
  27. package/dist/server/model/metadata.js.map +1 -0
  28. package/dist/server/model/return-types.d.ts +86 -0
  29. package/dist/server/model/return-types.js +110 -0
  30. package/dist/server/model/return-types.js.map +1 -0
  31. package/dist/server/model/server-types.d.ts +118 -0
  32. package/dist/server/model/server-types.js +47 -0
  33. package/dist/server/model/server-types.js.map +1 -0
  34. package/dist/server/parameter-processor.d.ts +13 -0
  35. package/dist/server/parameter-processor.js +84 -0
  36. package/dist/server/parameter-processor.js.map +1 -0
  37. package/dist/server/server-container.d.ts +55 -0
  38. package/dist/server/server-container.js +432 -0
  39. package/dist/server/server-container.js.map +1 -0
  40. package/dist/server/server.d.ts +136 -0
  41. package/dist/server/server.js +278 -0
  42. package/dist/server/server.js.map +1 -0
  43. package/dist/server/service-invoker.d.ts +28 -0
  44. package/dist/server/service-invoker.js +270 -0
  45. package/dist/server/service-invoker.js.map +1 -0
  46. package/dist/typescript-rest.d.ts +9 -0
  47. package/dist/typescript-rest.js +31 -0
  48. package/dist/typescript-rest.js.map +1 -0
  49. package/package.json +113 -0
  50. package/src/decorators/methods.ts +279 -0
  51. package/src/decorators/parameters.ts +442 -0
  52. package/src/decorators/services.ts +390 -0
  53. package/src/server/config.ts +40 -0
  54. package/src/server/model/errors.ts +178 -0
  55. package/src/server/model/metadata.ts +118 -0
  56. package/src/server/model/return-types.ts +109 -0
  57. package/src/server/model/server-types.ts +130 -0
  58. package/src/server/parameter-processor.ts +105 -0
  59. package/src/server/server-container.ts +504 -0
  60. package/src/server/server.ts +340 -0
  61. package/src/server/service-invoker.ts +266 -0
  62. package/src/typescript-rest.ts +16 -0
@@ -0,0 +1,7 @@
1
+ set -e
2
+
3
+ npm ci
4
+ npm run build
5
+ npm run lint
6
+ npx license-check
7
+ npx better-npm-audit audit --exclude=1096727,1097682
package/.eslintrc.js ADDED
@@ -0,0 +1,226 @@
1
+ module.exports = {
2
+ env: {
3
+ es6: true,
4
+ node: true
5
+ },
6
+ ignorePatterns: ['.eslintrc.js', 'jest.config.js'],
7
+ extends: [
8
+ 'plugin:@typescript-eslint/recommended',
9
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking',
10
+ 'prettier'
11
+ ],
12
+ parser: '@typescript-eslint/parser',
13
+ parserOptions: {
14
+ project: ['tsconfig.json', 'test/tsconfig.json'],
15
+ sourceType: 'module'
16
+ },
17
+ plugins: ['eslint-plugin-jsdoc', 'eslint-plugin-prefer-arrow', '@typescript-eslint'],
18
+ root: true,
19
+ rules: {
20
+ '@typescript-eslint/adjacent-overload-signatures': 'error',
21
+ '@typescript-eslint/array-type': [
22
+ 'error',
23
+ {
24
+ default: 'generic'
25
+ }
26
+ ],
27
+ '@typescript-eslint/ban-types': 'off',
28
+ '@typescript-eslint/consistent-type-assertions': 'error',
29
+ '@typescript-eslint/dot-notation': 'off',
30
+ '@typescript-eslint/explicit-function-return-type': 'off',
31
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
32
+ '@typescript-eslint/indent': 'off',
33
+ '@typescript-eslint/member-delimiter-style': [
34
+ 'error',
35
+ {
36
+ multiline: {
37
+ delimiter: 'semi',
38
+ requireLast: true
39
+ },
40
+ singleline: {
41
+ delimiter: 'semi',
42
+ requireLast: false
43
+ }
44
+ }
45
+ ],
46
+ '@typescript-eslint/naming-convention': [
47
+ 'off',
48
+ {
49
+ selector: 'variable',
50
+ format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
51
+ leadingUnderscore: 'allow',
52
+ trailingUnderscore: 'forbid'
53
+ }
54
+ ],
55
+ '@typescript-eslint/no-empty-function': 'error',
56
+ '@typescript-eslint/no-empty-interface': 'error',
57
+ '@typescript-eslint/no-explicit-any': 'off',
58
+ '@typescript-eslint/no-misused-new': 'error',
59
+ '@typescript-eslint/no-namespace': 'error',
60
+ '@typescript-eslint/no-parameter-properties': 'off',
61
+ '@typescript-eslint/no-shadow': [
62
+ 'error',
63
+ {
64
+ hoist: 'all'
65
+ }
66
+ ],
67
+ '@typescript-eslint/no-unused-expressions': 'error',
68
+ '@typescript-eslint/no-use-before-define': 'off',
69
+ '@typescript-eslint/no-var-requires': 'off',
70
+ '@typescript-eslint/prefer-for-of': 'error',
71
+ '@typescript-eslint/prefer-function-type': 'error',
72
+ '@typescript-eslint/prefer-namespace-keyword': 'error',
73
+ '@typescript-eslint/semi': ['error', 'always'],
74
+ '@typescript-eslint/triple-slash-reference': [
75
+ 'error',
76
+ {
77
+ path: 'always',
78
+ types: 'prefer-import',
79
+ lib: 'always'
80
+ }
81
+ ],
82
+ '@typescript-eslint/type-annotation-spacing': 'off',
83
+ '@typescript-eslint/typedef': 'off',
84
+ '@typescript-eslint/unified-signatures': 'error',
85
+ 'arrow-parens': ['off', 'always'],
86
+ 'brace-style': ['off', 'off'],
87
+ 'comma-dangle': 'off',
88
+ complexity: 'off',
89
+ 'constructor-super': 'error',
90
+ 'dot-notation': 'off',
91
+ 'eol-last': 'off',
92
+ eqeqeq: ['error', 'smart'],
93
+ 'guard-for-in': 'error',
94
+ 'id-denylist': [
95
+ 'error',
96
+ 'any',
97
+ 'Number',
98
+ 'number',
99
+ 'String',
100
+ 'string',
101
+ 'Boolean',
102
+ 'boolean',
103
+ 'Undefined',
104
+ 'undefined'
105
+ ],
106
+ 'id-match': 'error',
107
+ indent: 'off',
108
+ 'jsdoc/check-alignment': 'error',
109
+ 'jsdoc/check-indentation': 'error',
110
+ // "jsdoc/newline-after-description": "error",
111
+ 'linebreak-style': 'off',
112
+ 'max-classes-per-file': 'off',
113
+ 'max-len': 'off',
114
+ 'new-parens': 'off',
115
+ 'newline-per-chained-call': 'off',
116
+ 'no-bitwise': 'error',
117
+ 'no-caller': 'error',
118
+ 'no-cond-assign': 'error',
119
+ 'no-console': [
120
+ 'error',
121
+ {
122
+ allow: [
123
+ 'warn',
124
+ 'dir',
125
+ 'time',
126
+ 'timeEnd',
127
+ 'timeLog',
128
+ 'trace',
129
+ 'assert',
130
+ 'clear',
131
+ 'count',
132
+ 'countReset',
133
+ 'group',
134
+ 'groupEnd',
135
+ 'table',
136
+ 'debug',
137
+ 'info',
138
+ 'dirxml',
139
+ 'groupCollapsed',
140
+ 'Console',
141
+ 'profile',
142
+ 'profileEnd',
143
+ 'timeStamp',
144
+ 'context',
145
+ 'createTask'
146
+ ]
147
+ }
148
+ ],
149
+ 'no-debugger': 'error',
150
+ 'no-empty': 'error',
151
+ 'no-empty-function': 'off',
152
+ 'no-eval': 'error',
153
+ 'no-extra-semi': 'off',
154
+ 'no-fallthrough': 'off',
155
+ 'no-invalid-this': 'off',
156
+ 'no-irregular-whitespace': 'off',
157
+ 'no-multiple-empty-lines': 'off',
158
+ 'no-new-wrappers': 'error',
159
+ 'no-shadow': 'off',
160
+ 'no-throw-literal': 'error',
161
+ 'no-trailing-spaces': 'off',
162
+ 'no-undef-init': 'error',
163
+ 'no-underscore-dangle': 'off',
164
+ 'no-unsafe-finally': 'error',
165
+ 'no-unused-expressions': 'off',
166
+ 'no-unused-labels': 'error',
167
+ 'no-use-before-define': 'off',
168
+ 'no-var': 'error',
169
+ 'object-shorthand': ['error', 'never'],
170
+ 'one-var': ['error', 'never'],
171
+ 'padded-blocks': [
172
+ 'off',
173
+ {
174
+ blocks: 'never'
175
+ },
176
+ {
177
+ allowSingleLineBlocks: true
178
+ }
179
+ ],
180
+ 'prefer-arrow/prefer-arrow-functions': [
181
+ 'error',
182
+ {
183
+ allowStandaloneDeclarations: true
184
+ }
185
+ ],
186
+ 'prefer-const': 'error',
187
+ 'quote-props': 'off',
188
+ radix: 'error',
189
+ 'react/jsx-curly-spacing': 'off',
190
+ 'react/jsx-equals-spacing': 'off',
191
+ 'react/jsx-tag-spacing': [
192
+ 'off',
193
+ {
194
+ afterOpening: 'allow',
195
+ closingSlash: 'allow'
196
+ }
197
+ ],
198
+ 'react/jsx-wrap-multilines': 'off',
199
+ semi: 'off',
200
+ 'space-before-function-paren': 'off',
201
+ 'space-in-parens': ['off', 'never'],
202
+ 'spaced-comment': [
203
+ 'error',
204
+ 'always',
205
+ {
206
+ markers: ['/']
207
+ }
208
+ ],
209
+ 'use-isnan': 'error',
210
+ 'valid-typeof': 'off',
211
+ '@typescript-eslint/no-unsafe-argument': 'off',
212
+ '@typescript-eslint/no-unsafe-member-access': 'off',
213
+ 'constructor-super': 'off',
214
+ '@typescript-eslint/no-unsafe-assignment': 'off',
215
+ '@typescript-eslint/no-unsafe-return': 'off',
216
+ '@typescript-eslint/no-unsafe-call': 'off',
217
+ '@typescript-eslint/unbound-method': 'off',
218
+ '@typescript-eslint/no-unused-vars': [
219
+ 'error',
220
+ {
221
+ argsIgnorePattern: '^_',
222
+ varsIgnorePattern: '^_'
223
+ }
224
+ ]
225
+ }
226
+ };
@@ -0,0 +1,27 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: 'github-actions'
4
+ directory: '/'
5
+ schedule:
6
+ interval: 'weekly'
7
+ groups:
8
+ update-github-actions-dependencies:
9
+ patterns:
10
+ - '*'
11
+ reviewers:
12
+ - 'jkoenig134'
13
+ labels:
14
+ - 'dependencies'
15
+
16
+ - package-ecosystem: 'npm'
17
+ directory: '/'
18
+ schedule:
19
+ interval: 'weekly'
20
+ groups:
21
+ update-npm-dependencies:
22
+ patterns:
23
+ - '*'
24
+ reviewers:
25
+ - 'jkoenig134'
26
+ labels:
27
+ - 'dependencies'
@@ -0,0 +1,33 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+
7
+ jobs:
8
+ run-checks:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: actions/setup-node@v4
13
+ with:
14
+ node-version: current
15
+ - run: bash .ci/runChecks.sh
16
+
17
+ publish-npm:
18
+ runs-on: ubuntu-latest
19
+ permissions:
20
+ contents: read
21
+ id-token: write
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ - uses: actions/setup-node@v4
25
+ with:
26
+ node-version: current
27
+ registry-url: https://registry.npmjs.org/
28
+ - run: npm ci
29
+ - run: npm run build
30
+ - run: npx enhanced-publish --if-possible --use-preid-as-tag
31
+ env:
32
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
33
+ needs: ['run-checks']
@@ -0,0 +1,31 @@
1
+ name: Test
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [master]
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
10
+ cancel-in-progress: true
11
+
12
+ jobs:
13
+ run-checks:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-node@v4
18
+ with:
19
+ node-version: current
20
+ - run: bash .ci/runChecks.sh
21
+
22
+ test:
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - uses: actions/setup-node@v4
27
+ with:
28
+ node-version: current
29
+ - run: npm ci
30
+ - run: npm run build
31
+ - run: npm run test
package/.prettierrc ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "semi": true,
3
+ "tabWidth": 4,
4
+ "singleQuote": true,
5
+ "printWidth": 120,
6
+ "trailingComma": "none",
7
+ "overrides": [
8
+ {
9
+ "files": "*.json",
10
+ "options": {
11
+ "tabWidth": 2
12
+ }
13
+ },
14
+ {
15
+ "files": "*.yml",
16
+ "options": {
17
+ "tabWidth": 2
18
+ }
19
+ },
20
+ {
21
+ "files": ".prettierrc",
22
+ "options": {
23
+ "tabWidth": 2
24
+ }
25
+ }
26
+ ]
27
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "[jsonc]": {
3
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
4
+ },
5
+ "[json]": {
6
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
7
+ },
8
+ "[javascript]": {
9
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
10
+ },
11
+ "[typescript]": {
12
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
13
+ },
14
+ "[yaml]": {
15
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
16
+ },
17
+ "[markdown]": {
18
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
19
+ },
20
+ "editor.formatOnSave": true,
21
+ "editor.formatOnPaste": true,
22
+ "files.autoSave": "off",
23
+ "html.format.wrapAttributes": "preserve-aligned",
24
+ "xmlTools.splitAttributesOnFormat": true,
25
+ "xmlTools.enforcePrettySelfClosingTagOnFormat": true,
26
+ "editor.codeActionsOnSave": {
27
+ "source.organizeImports": "always"
28
+ },
29
+ "files.eol": "\n",
30
+ "typescript.tsdk": "node_modules/typescript/lib"
31
+ }
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2016 Thiago da Rosa de Bustamante
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,128 @@
1
+ [![npm version](https://badge.fury.io/js/typescript-rest.svg)](https://badge.fury.io/js/typescript-rest)
2
+ ![Master Workflow](https://github.com/thiagobustamante/typescript-rest/workflows/Master%20Workflow/badge.svg)
3
+ [![Coverage Status](https://codecov.io/gh/thiagobustamante/typescript-rest/branch/master/graph/badge.svg)](https://codecov.io/gh/thiagobustamante/typescript-rest)
4
+ [![Known Vulnerabilities](https://snyk.io/test/github/thiagobustamante/typescript-rest/badge.svg?targetFile=package.json)](https://snyk.io/test/github/thiagobustamante/typescript-rest?targetFile=package.json)
5
+ [![BCH compliance](https://bettercodehub.com/edge/badge/thiagobustamante/typescript-rest?branch=master)](https://bettercodehub.com/)
6
+
7
+ # REST Services for Typescript
8
+
9
+ This is a lightweight annotation-based [expressjs](http://expressjs.com/) extension for typescript.
10
+
11
+ It can be used to define your APIs using decorators.
12
+
13
+ **Table of Contents**
14
+
15
+ - [REST Services for Typescript](#rest-services-for-typescript)
16
+ - [Installation](#installation)
17
+ - [Configuration](#configuration)
18
+ - [Basic Usage](#basic-usage)
19
+ - [Using with an IoC Container](#using-with-an-ioc-container)
20
+ - [Complete Guide](#complete-guide)
21
+ - [Boilerplate Project](#boilerplate-project)
22
+
23
+ ## Installation
24
+
25
+ This library only works with typescript. Ensure it is installed:
26
+
27
+ ```bash
28
+ npm install typescript -g
29
+ ```
30
+
31
+ To install typescript-rest:
32
+
33
+ ```bash
34
+ npm install typescript-rest --save
35
+ ```
36
+
37
+ ## Configuration
38
+
39
+ Typescript-rest requires the following TypeScript compilation options in your tsconfig.json file:
40
+
41
+ ```typescript
42
+ {
43
+ "compilerOptions": {
44
+ "experimentalDecorators": true,
45
+ "emitDecoratorMetadata": true,
46
+ "target": "es6" // or anything newer like esnext
47
+ }
48
+ }
49
+ ```
50
+
51
+ ## Basic Usage
52
+
53
+ ```typescript
54
+ import * as express from 'express';
55
+ import { Server, Path, GET, PathParam } from 'typescript-rest';
56
+
57
+ @Path('/hello')
58
+ class HelloService {
59
+ @Path(':name')
60
+ @GET
61
+ sayHello(@PathParam('name') name: string): string {
62
+ return 'Hello ' + name;
63
+ }
64
+ }
65
+
66
+ let app: express.Application = express();
67
+ Server.buildServices(app);
68
+
69
+ app.listen(3000, function () {
70
+ console.log('Rest Server listening on port 3000!');
71
+ });
72
+ ```
73
+
74
+ That's it. You can just call now:
75
+
76
+ ```
77
+ GET http://localhost:3000/hello/joe
78
+ ```
79
+
80
+ ## Using with an IoC Container
81
+
82
+ Install the IoC container and the serviceFactory for the IoC Container
83
+
84
+ ```bash
85
+ npm install @nmshd/typescript-rest --save
86
+ npm install @nmshd/typescript-ioc --save
87
+ npm install @nmshd/typescript-rest-ioc --save
88
+ ```
89
+
90
+ Then add a rest.config file in the root of your project:
91
+
92
+ ```json
93
+ {
94
+ "serviceFactory": "@nmshd/typescript-rest-ioc"
95
+ }
96
+ ```
97
+
98
+ And you can use Injections, Request scopes and all the features of the IoC Container. It is possible to use it with any other IoC Container, like Inversify.
99
+
100
+ Example:
101
+
102
+ ```typescript
103
+ class HelloService {
104
+ sayHello(name: string) {
105
+ return 'Hello ' + name;
106
+ }
107
+ }
108
+
109
+ @Path('/hello')
110
+ class HelloRestService {
111
+ @Inject
112
+ private helloService: HelloService;
113
+
114
+ @Path(':name')
115
+ @GET
116
+ sayHello(@PathParam('name') name: string): string {
117
+ return this.sayHello(name);
118
+ }
119
+ }
120
+ ```
121
+
122
+ ## Complete Guide
123
+
124
+ Check our [documentation](https://github.com/thiagobustamante/typescript-rest/wiki).
125
+
126
+ ## Boilerplate Project
127
+
128
+ You can check [this project](https://github.com/vrudikov/typescript-rest-boilerplate) to get started.
@@ -0,0 +1,165 @@
1
+ import 'reflect-metadata';
2
+ /**
3
+ * A decorator to tell the [[Server]] that a method
4
+ * should be called to process HTTP GET requests.
5
+ *
6
+ * For example:
7
+ *
8
+ * ```
9
+ * @ Path('people')
10
+ * class PeopleService {
11
+ * @ GET
12
+ * getPeople() {
13
+ * // ...
14
+ * }
15
+ * }
16
+ * ```
17
+ *
18
+ * Will create a service that listen for requests like:
19
+ *
20
+ * ```
21
+ * GET http://mydomain/people
22
+ * ```
23
+ */
24
+ export declare function GET(target: any, propertyKey: string): void;
25
+ /**
26
+ * A decorator to tell the [[Server]] that a method
27
+ * should be called to process HTTP POST requests.
28
+ *
29
+ * For example:
30
+ *
31
+ * ```
32
+ * @ Path('people')
33
+ * class PeopleService {
34
+ * @ POST
35
+ * addPerson() {
36
+ * // ...
37
+ * }
38
+ * }
39
+ * ```
40
+ *
41
+ * Will create a service that listen for requests like:
42
+ *
43
+ * ```
44
+ * POST http://mydomain/people
45
+ * ```
46
+ */
47
+ export declare function POST(target: any, propertyKey: string): void;
48
+ /**
49
+ * A decorator to tell the [[Server]] that a method
50
+ * should be called to process HTTP PUT requests.
51
+ *
52
+ * For example:
53
+ *
54
+ * ```
55
+ * @ Path('people')
56
+ * class PeopleService {
57
+ * @ PUT
58
+ * @ Path(':id')
59
+ * savePerson(person: Person) {
60
+ * // ...
61
+ * }
62
+ * }
63
+ * ```
64
+ *
65
+ * Will create a service that listen for requests like:
66
+ *
67
+ * ```
68
+ * PUT http://mydomain/people/123
69
+ * ```
70
+ */
71
+ export declare function PUT(target: any, propertyKey: string): void;
72
+ /**
73
+ * A decorator to tell the [[Server]] that a method
74
+ * should be called to process HTTP DELETE requests.
75
+ *
76
+ * For example:
77
+ *
78
+ * ```
79
+ * @ Path('people')
80
+ * class PeopleService {
81
+ * @ DELETE
82
+ * @ Path(':id')
83
+ * removePerson(@ PathParam('id')id: string) {
84
+ * // ...
85
+ * }
86
+ * }
87
+ * ```
88
+ *
89
+ * Will create a service that listen for requests like:
90
+ *
91
+ * ```
92
+ * PUT http://mydomain/people/123
93
+ * ```
94
+ */
95
+ export declare function DELETE(target: any, propertyKey: string): void;
96
+ /**
97
+ * A decorator to tell the [[Server]] that a method
98
+ * should be called to process HTTP HEAD requests.
99
+ *
100
+ * For example:
101
+ *
102
+ * ```
103
+ * @ Path('people')
104
+ * class PeopleService {
105
+ * @ HEAD
106
+ * headPerson() {
107
+ * // ...
108
+ * }
109
+ * }
110
+ * ```
111
+ *
112
+ * Will create a service that listen for requests like:
113
+ *
114
+ * ```
115
+ * HEAD http://mydomain/people/123
116
+ * ```
117
+ */
118
+ export declare function HEAD(target: any, propertyKey: string): void;
119
+ /**
120
+ * A decorator to tell the [[Server]] that a method
121
+ * should be called to process HTTP OPTIONS requests.
122
+ *
123
+ * For example:
124
+ *
125
+ * ```
126
+ * @ Path('people')
127
+ * class PeopleService {
128
+ * @ OPTIONS
129
+ * optionsPerson() {
130
+ * // ...
131
+ * }
132
+ * }
133
+ * ```
134
+ *
135
+ * Will create a service that listen for requests like:
136
+ *
137
+ * ```
138
+ * OPTIONS http://mydomain/people/123
139
+ * ```
140
+ */
141
+ export declare function OPTIONS(target: any, propertyKey: string): void;
142
+ /**
143
+ * A decorator to tell the [[Server]] that a method
144
+ * should be called to process HTTP PATCH requests.
145
+ *
146
+ * For example:
147
+ *
148
+ * ```
149
+ * @ Path('people')
150
+ * class PeopleService {
151
+ * @ PATCH
152
+ * @ Path(':id')
153
+ * savePerson(person: Person) {
154
+ * // ...
155
+ * }
156
+ * }
157
+ * ```
158
+ *
159
+ * Will create a service that listen for requests like:
160
+ *
161
+ * ```
162
+ * PATCH http://mydomain/people/123
163
+ * ```
164
+ */
165
+ export declare function PATCH(target: any, propertyKey: string): void;