web_api_base 4.0.8 → 5.1.0
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/Application.d.ts +3 -1
- package/dist/Application.js +173 -42
- package/dist/Application.js.map +1 -1
- package/dist/File/AbstractFileService.d.ts +11 -0
- package/dist/File/AbstractFileService.js +6 -0
- package/dist/File/AbstractFileService.js.map +1 -0
- package/dist/File/AbstractMultiPartRequestService.d.ts +16 -0
- package/dist/File/AbstractMultiPartRequestService.js +12 -0
- package/dist/File/AbstractMultiPartRequestService.js.map +1 -0
- package/dist/File/File.d.ts +5 -0
- package/dist/File/File.js +10 -0
- package/dist/File/File.js.map +1 -0
- package/dist/File/FileService.d.ts +12 -0
- package/dist/File/FileService.js +136 -0
- package/dist/File/FileService.js.map +1 -0
- package/dist/File/FormidableMultiPartRequestService.d.ts +4 -0
- package/dist/File/FormidableMultiPartRequestService.js +73 -0
- package/dist/File/FormidableMultiPartRequestService.js.map +1 -0
- package/dist/decorators/controllers/ControllerDecorators.d.ts +16 -0
- package/dist/decorators/controllers/ControllerDecorators.js +75 -0
- package/dist/decorators/controllers/ControllerDecorators.js.map +1 -1
- package/dist/decorators/documentation/DocumentationDecorators.js.map +1 -1
- package/dist/documentation/Documentation.js +6 -1
- package/dist/documentation/Documentation.js.map +1 -1
- package/dist/documentation/JS.js +103 -10
- package/dist/documentation/JS.js.map +1 -1
- package/dist/exceptions/DecoratorException.d.ts +3 -0
- package/dist/exceptions/DecoratorException.js +10 -0
- package/dist/exceptions/DecoratorException.js.map +1 -0
- package/dist/exceptions/FileNotFoundException.d.ts +3 -0
- package/dist/exceptions/FileNotFoundException.js +10 -0
- package/dist/exceptions/FileNotFoundException.js.map +1 -0
- package/dist/exceptions/InvalidEntityException.d.ts +3 -0
- package/dist/exceptions/InvalidEntityException.js +10 -0
- package/dist/exceptions/InvalidEntityException.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/dist/metadata/Type.d.ts +1 -0
- package/dist/metadata/Type.js +52 -0
- package/dist/metadata/Type.js.map +1 -1
- package/dist/midlewares/IMidleware.d.ts +3 -3
- package/dist/temp/Application.d.ts +5 -0
- package/dist/temp/Application.js +29 -0
- package/dist/temp/Application.js.map +1 -0
- package/dist/temp/Index.d.ts +1 -0
- package/dist/temp/Index.js +19 -0
- package/dist/temp/Index.js.map +1 -0
- package/dist/temp/controllers/StatusController.d.ts +25 -0
- package/dist/temp/controllers/StatusController.js +158 -0
- package/dist/temp/controllers/StatusController.js.map +1 -0
- package/dist/temp/service/SampleService.d.ts +11 -0
- package/dist/temp/service/SampleService.js +24 -0
- package/dist/temp/service/SampleService.js.map +1 -0
- package/package.json +3 -1
- package/readme.md +20 -0
package/readme.md
CHANGED
|
@@ -257,6 +257,16 @@ export default class StatusController extends ControllerBase
|
|
|
257
257
|
```
|
|
258
258
|
|
|
259
259
|
|
|
260
|
+
### @UseHeader()
|
|
261
|
+
Define that the request must have some header
|
|
262
|
+
```typescript
|
|
263
|
+
@Route("/status")
|
|
264
|
+
@UseHeader('api_token')
|
|
265
|
+
export default class StatusController extends ControllerBase
|
|
266
|
+
{
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
|
|
260
270
|
# Model Bind decorators
|
|
261
271
|
|
|
262
272
|
### @FromBody()
|
|
@@ -304,8 +314,18 @@ public async GetByIdAsync(@FromQuery()id : number) : Promise<OKResult<User>>
|
|
|
304
314
|
In the example above, the __model binding system__ will get the first query argument of request.
|
|
305
315
|
We can also determine the name of parameter: __@FromQuery('id')__.
|
|
306
316
|
|
|
317
|
+
### @FromFiles()
|
|
318
|
+
Extract a method File(web_api_base) type parameter from multipart/form-data request
|
|
307
319
|
|
|
308
320
|
|
|
321
|
+
```typescript
|
|
322
|
+
@POST()
|
|
323
|
+
public async InsertAsync(@FromFiles()file: File) : Promise<User>
|
|
324
|
+
{
|
|
325
|
+
return await this._service.MoveFiles(file, newPath);
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
309
329
|
## Sample of a complete controller
|
|
310
330
|
|
|
311
331
|
```typescript
|