@spinajs/http 2.0.179 → 2.0.181
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/lib/cjs/bootstrap.d.ts +4 -4
- package/lib/cjs/bootstrap.js +29 -29
- package/lib/cjs/bootstrap.js.map +1 -1
- package/lib/cjs/config/http.d.ts +58 -58
- package/lib/cjs/config/http.js +86 -86
- package/lib/cjs/controllers.d.ts +48 -48
- package/lib/cjs/controllers.d.ts.map +1 -1
- package/lib/cjs/controllers.js +307 -312
- package/lib/cjs/controllers.js.map +1 -1
- package/lib/cjs/decorators.d.ts +183 -183
- package/lib/cjs/decorators.js +441 -441
- package/lib/cjs/hydrators/DateTimeHydrator.d.ts +5 -5
- package/lib/cjs/hydrators/DateTimeHydrator.js +36 -36
- package/lib/cjs/hydrators/DateTimeHydrator.js.map +1 -1
- package/lib/cjs/index.d.ts +9 -9
- package/lib/cjs/index.js +25 -25
- package/lib/cjs/interfaces.d.ts +569 -550
- package/lib/cjs/interfaces.d.ts.map +1 -1
- package/lib/cjs/interfaces.js +266 -259
- package/lib/cjs/interfaces.js.map +1 -1
- package/lib/cjs/middlewares/RealIp.d.ts +8 -8
- package/lib/cjs/middlewares/RealIp.js +34 -34
- package/lib/cjs/middlewares/RealIp.js.map +1 -1
- package/lib/cjs/middlewares/RequestId.d.ts +8 -8
- package/lib/cjs/middlewares/RequestId.js +35 -35
- package/lib/cjs/middlewares/RequestId.js.map +1 -1
- package/lib/cjs/middlewares/ResponseTime.d.ts +10 -10
- package/lib/cjs/middlewares/ResponseTime.js +41 -41
- package/lib/cjs/middlewares/ResponseTime.js.map +1 -1
- package/lib/cjs/response-methods/badRequest.d.ts +12 -12
- package/lib/cjs/response-methods/badRequest.js +20 -20
- package/lib/cjs/response-methods/conflict.d.ts +12 -12
- package/lib/cjs/response-methods/conflict.js +20 -20
- package/lib/cjs/response-methods/cookieResponse.d.ts +19 -19
- package/lib/cjs/response-methods/cookieResponse.js +73 -73
- package/lib/cjs/response-methods/created.d.ts +12 -12
- package/lib/cjs/response-methods/created.js +19 -19
- package/lib/cjs/response-methods/errorResponse.d.ts +7 -7
- package/lib/cjs/response-methods/errorResponse.js +24 -24
- package/lib/cjs/response-methods/file.d.ts +26 -26
- package/lib/cjs/response-methods/file.d.ts.map +1 -1
- package/lib/cjs/response-methods/file.js +112 -133
- package/lib/cjs/response-methods/file.js.map +1 -1
- package/lib/cjs/response-methods/forbidden.d.ts +12 -12
- package/lib/cjs/response-methods/forbidden.js +20 -20
- package/lib/cjs/response-methods/index.d.ts +13 -13
- package/lib/cjs/response-methods/index.js +29 -29
- package/lib/cjs/response-methods/noContent.d.ts +12 -12
- package/lib/cjs/response-methods/noContent.js +20 -20
- package/lib/cjs/response-methods/notAcceptable.d.ts +13 -13
- package/lib/cjs/response-methods/notAcceptable.js +21 -21
- package/lib/cjs/response-methods/notAllowed.d.ts +12 -12
- package/lib/cjs/response-methods/notAllowed.js +20 -20
- package/lib/cjs/response-methods/notFound.d.ts +12 -12
- package/lib/cjs/response-methods/notFound.js +20 -20
- package/lib/cjs/response-methods/ok.d.ts +12 -12
- package/lib/cjs/response-methods/ok.js +19 -19
- package/lib/cjs/response-methods/redirect.d.ts +12 -12
- package/lib/cjs/response-methods/redirect.js +19 -19
- package/lib/cjs/response-methods/serverError.d.ts +12 -12
- package/lib/cjs/response-methods/serverError.js +20 -20
- package/lib/cjs/response-methods/template.d.ts +15 -15
- package/lib/cjs/response-methods/template.js +36 -36
- package/lib/cjs/response-methods/unauthorized.d.ts +12 -12
- package/lib/cjs/response-methods/unauthorized.js +20 -20
- package/lib/cjs/response-methods/validationError.d.ts +12 -12
- package/lib/cjs/response-methods/validationError.js +20 -20
- package/lib/cjs/responses.d.ts +34 -34
- package/lib/cjs/responses.js +173 -173
- package/lib/cjs/route-args/ArgAsRequest.d.ts +11 -11
- package/lib/cjs/route-args/ArgAsRequest.js +24 -24
- package/lib/cjs/route-args/ArgAsRequest.js.map +1 -1
- package/lib/cjs/route-args/ArgAsResponse.d.ts +10 -10
- package/lib/cjs/route-args/ArgAsResponse.js +24 -24
- package/lib/cjs/route-args/ArgAsResponse.js.map +1 -1
- package/lib/cjs/route-args/ArgHydrator.d.ts +4 -4
- package/lib/cjs/route-args/ArgHydrator.js +6 -6
- package/lib/cjs/route-args/FromBody.d.ts +10 -10
- package/lib/cjs/route-args/FromBody.js +26 -26
- package/lib/cjs/route-args/FromBody.js.map +1 -1
- package/lib/cjs/route-args/FromCookie.d.ts +13 -13
- package/lib/cjs/route-args/FromCookie.js +72 -72
- package/lib/cjs/route-args/FromCookie.js.map +1 -1
- package/lib/cjs/route-args/FromDi.d.ts +13 -13
- package/lib/cjs/route-args/FromDi.js +35 -35
- package/lib/cjs/route-args/FromDi.js.map +1 -1
- package/lib/cjs/route-args/FromForm.d.ts +66 -92
- package/lib/cjs/route-args/FromForm.d.ts.map +1 -1
- package/lib/cjs/route-args/FromForm.js +214 -291
- package/lib/cjs/route-args/FromForm.js.map +1 -1
- package/lib/cjs/route-args/FromHeaderArg.d.ts +10 -10
- package/lib/cjs/route-args/FromHeaderArg.js +25 -25
- package/lib/cjs/route-args/FromHeaderArg.js.map +1 -1
- package/lib/cjs/route-args/FromParams.d.ts +10 -10
- package/lib/cjs/route-args/FromParams.js +27 -27
- package/lib/cjs/route-args/FromParams.js.map +1 -1
- package/lib/cjs/route-args/FromQuery.d.ts +10 -10
- package/lib/cjs/route-args/FromQuery.js +27 -27
- package/lib/cjs/route-args/FromQuery.js.map +1 -1
- package/lib/cjs/route-args/RequestFields.d.ts +40 -40
- package/lib/cjs/route-args/RequestFields.js +110 -110
- package/lib/cjs/route-args/RequestFields.js.map +1 -1
- package/lib/cjs/route-args/RouteArgs.d.ts +22 -22
- package/lib/cjs/route-args/RouteArgs.js +114 -114
- package/lib/cjs/route-args/RouteArgs.js.map +1 -1
- package/lib/cjs/route-args/index.d.ts +12 -12
- package/lib/cjs/route-args/index.js +28 -28
- package/lib/cjs/schemas/RouteArgsSchemas.d.ts +36 -36
- package/lib/cjs/schemas/RouteArgsSchemas.js +26 -26
- package/lib/cjs/server.d.ts +50 -50
- package/lib/cjs/server.js +272 -272
- package/lib/cjs/server.js.map +1 -1
- package/lib/cjs/transformers/PureTransformer.d.ts +9 -9
- package/lib/cjs/transformers/PureTransformer.js +27 -27
- package/lib/cjs/transformers/PureTransformer.js.map +1 -1
- package/lib/cjs/transformers/index.d.ts +1 -1
- package/lib/cjs/transformers/index.js +17 -17
- package/lib/cjs/uploaders/ImmediateFileUploader.d.ts +19 -0
- package/lib/cjs/uploaders/ImmediateFileUploader.d.ts.map +1 -0
- package/lib/cjs/uploaders/ImmediateFileUploader.js +69 -0
- package/lib/cjs/uploaders/ImmediateFileUploader.js.map +1 -0
- package/lib/mjs/bootstrap.d.ts +4 -4
- package/lib/mjs/bootstrap.js +26 -26
- package/lib/mjs/bootstrap.js.map +1 -1
- package/lib/mjs/config/http.d.ts +58 -58
- package/lib/mjs/config/http.js +81 -81
- package/lib/mjs/controllers.d.ts +48 -48
- package/lib/mjs/controllers.d.ts.map +1 -1
- package/lib/mjs/controllers.js +276 -281
- package/lib/mjs/controllers.js.map +1 -1
- package/lib/mjs/decorators.d.ts +183 -183
- package/lib/mjs/decorators.js +404 -404
- package/lib/mjs/exceptions.d.ts +1 -1
- package/lib/mjs/exceptions.js +1 -1
- package/lib/mjs/hydrators/DateTimeHydrator.d.ts +5 -5
- package/lib/mjs/hydrators/DateTimeHydrator.js +30 -30
- package/lib/mjs/hydrators/DateTimeHydrator.js.map +1 -1
- package/lib/mjs/index.d.ts +9 -9
- package/lib/mjs/index.js +9 -9
- package/lib/mjs/interfaces.d.ts +569 -550
- package/lib/mjs/interfaces.d.ts.map +1 -1
- package/lib/mjs/interfaces.js +257 -251
- package/lib/mjs/interfaces.js.map +1 -1
- package/lib/mjs/middlewares/RealIp.d.ts +8 -8
- package/lib/mjs/middlewares/RealIp.js +31 -31
- package/lib/mjs/middlewares/RealIp.js.map +1 -1
- package/lib/mjs/middlewares/RequestId.d.ts +8 -8
- package/lib/mjs/middlewares/RequestId.js +32 -32
- package/lib/mjs/middlewares/RequestId.js.map +1 -1
- package/lib/mjs/middlewares/ResponseTime.d.ts +10 -10
- package/lib/mjs/middlewares/ResponseTime.js +38 -38
- package/lib/mjs/middlewares/ResponseTime.js.map +1 -1
- package/lib/mjs/response-methods/badRequest.d.ts +12 -12
- package/lib/mjs/response-methods/badRequest.js +16 -16
- package/lib/mjs/response-methods/conflict.d.ts +12 -12
- package/lib/mjs/response-methods/conflict.js +16 -16
- package/lib/mjs/response-methods/cookieResponse.d.ts +19 -19
- package/lib/mjs/response-methods/cookieResponse.js +46 -46
- package/lib/mjs/response-methods/created.d.ts +12 -12
- package/lib/mjs/response-methods/created.js +15 -15
- package/lib/mjs/response-methods/errorResponse.d.ts +7 -7
- package/lib/mjs/response-methods/errorResponse.js +17 -17
- package/lib/mjs/response-methods/file.d.ts +26 -26
- package/lib/mjs/response-methods/file.d.ts.map +1 -1
- package/lib/mjs/response-methods/file.js +103 -124
- package/lib/mjs/response-methods/file.js.map +1 -1
- package/lib/mjs/response-methods/forbidden.d.ts +12 -12
- package/lib/mjs/response-methods/forbidden.js +16 -16
- package/lib/mjs/response-methods/index.d.ts +13 -13
- package/lib/mjs/response-methods/index.js +13 -13
- package/lib/mjs/response-methods/noContent.d.ts +12 -12
- package/lib/mjs/response-methods/noContent.js +16 -16
- package/lib/mjs/response-methods/notAcceptable.d.ts +13 -13
- package/lib/mjs/response-methods/notAcceptable.js +17 -17
- package/lib/mjs/response-methods/notAllowed.d.ts +12 -12
- package/lib/mjs/response-methods/notAllowed.js +16 -16
- package/lib/mjs/response-methods/notFound.d.ts +12 -12
- package/lib/mjs/response-methods/notFound.js +16 -16
- package/lib/mjs/response-methods/ok.d.ts +12 -12
- package/lib/mjs/response-methods/ok.js +15 -15
- package/lib/mjs/response-methods/redirect.d.ts +12 -12
- package/lib/mjs/response-methods/redirect.js +15 -15
- package/lib/mjs/response-methods/serverError.d.ts +12 -12
- package/lib/mjs/response-methods/serverError.js +16 -16
- package/lib/mjs/response-methods/template.d.ts +15 -15
- package/lib/mjs/response-methods/template.js +29 -29
- package/lib/mjs/response-methods/unauthorized.d.ts +12 -12
- package/lib/mjs/response-methods/unauthorized.js +16 -16
- package/lib/mjs/response-methods/validationError.d.ts +12 -12
- package/lib/mjs/response-methods/validationError.js +16 -16
- package/lib/mjs/responses.d.ts +34 -34
- package/lib/mjs/responses.js +143 -143
- package/lib/mjs/route-args/ArgAsRequest.d.ts +11 -11
- package/lib/mjs/route-args/ArgAsRequest.js +21 -21
- package/lib/mjs/route-args/ArgAsRequest.js.map +1 -1
- package/lib/mjs/route-args/ArgAsResponse.d.ts +10 -10
- package/lib/mjs/route-args/ArgAsResponse.js +21 -21
- package/lib/mjs/route-args/ArgAsResponse.js.map +1 -1
- package/lib/mjs/route-args/ArgHydrator.d.ts +4 -4
- package/lib/mjs/route-args/ArgHydrator.js +2 -2
- package/lib/mjs/route-args/FromBody.d.ts +10 -10
- package/lib/mjs/route-args/FromBody.js +23 -23
- package/lib/mjs/route-args/FromBody.js.map +1 -1
- package/lib/mjs/route-args/FromCookie.d.ts +13 -13
- package/lib/mjs/route-args/FromCookie.js +46 -46
- package/lib/mjs/route-args/FromCookie.js.map +1 -1
- package/lib/mjs/route-args/FromDi.d.ts +13 -13
- package/lib/mjs/route-args/FromDi.js +32 -32
- package/lib/mjs/route-args/FromDi.js.map +1 -1
- package/lib/mjs/route-args/FromForm.d.ts +66 -92
- package/lib/mjs/route-args/FromForm.d.ts.map +1 -1
- package/lib/mjs/route-args/FromForm.js +210 -284
- package/lib/mjs/route-args/FromForm.js.map +1 -1
- package/lib/mjs/route-args/FromHeaderArg.d.ts +10 -10
- package/lib/mjs/route-args/FromHeaderArg.js +22 -22
- package/lib/mjs/route-args/FromHeaderArg.js.map +1 -1
- package/lib/mjs/route-args/FromParams.d.ts +10 -10
- package/lib/mjs/route-args/FromParams.js +24 -24
- package/lib/mjs/route-args/FromParams.js.map +1 -1
- package/lib/mjs/route-args/FromQuery.d.ts +10 -10
- package/lib/mjs/route-args/FromQuery.js +24 -24
- package/lib/mjs/route-args/FromQuery.js.map +1 -1
- package/lib/mjs/route-args/RequestFields.d.ts +40 -40
- package/lib/mjs/route-args/RequestFields.js +107 -107
- package/lib/mjs/route-args/RequestFields.js.map +1 -1
- package/lib/mjs/route-args/RouteArgs.d.ts +22 -22
- package/lib/mjs/route-args/RouteArgs.js +107 -107
- package/lib/mjs/route-args/RouteArgs.js.map +1 -1
- package/lib/mjs/route-args/index.d.ts +12 -12
- package/lib/mjs/route-args/index.js +12 -12
- package/lib/mjs/schemas/RouteArgsSchemas.d.ts +36 -36
- package/lib/mjs/schemas/RouteArgsSchemas.js +23 -23
- package/lib/mjs/server.d.ts +50 -50
- package/lib/mjs/server.js +266 -266
- package/lib/mjs/server.js.map +1 -1
- package/lib/mjs/transformers/PureTransformer.d.ts +9 -9
- package/lib/mjs/transformers/PureTransformer.js +24 -24
- package/lib/mjs/transformers/PureTransformer.js.map +1 -1
- package/lib/mjs/transformers/index.d.ts +1 -1
- package/lib/mjs/transformers/index.js +1 -1
- package/lib/mjs/uploaders/ImmediateFileUploader.d.ts +19 -0
- package/lib/mjs/uploaders/ImmediateFileUploader.d.ts.map +1 -0
- package/lib/mjs/uploaders/ImmediateFileUploader.js +66 -0
- package/lib/mjs/uploaders/ImmediateFileUploader.js.map +1 -0
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.mjs.tsbuildinfo +1 -1
- package/package.json +17 -17
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
-
import { httpResponse } from '../responses.js';
|
|
3
|
-
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 403 FORBIDDEN ERROR
|
|
7
|
-
* @param err - error to send
|
|
8
|
-
*/
|
|
9
|
-
export class NotAllowed extends ErrorResponse {
|
|
10
|
-
constructor(data) {
|
|
11
|
-
super(data);
|
|
12
|
-
}
|
|
13
|
-
async execute(_req, _res) {
|
|
14
|
-
return await httpResponse(this.responseData, HTTP_STATUS_CODE.NOT_ALLOWED, 'not-allowed.pug');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
3
|
+
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 403 FORBIDDEN ERROR
|
|
7
|
+
* @param err - error to send
|
|
8
|
+
*/
|
|
9
|
+
export class NotAllowed extends ErrorResponse {
|
|
10
|
+
constructor(data) {
|
|
11
|
+
super(data);
|
|
12
|
+
}
|
|
13
|
+
async execute(_req, _res) {
|
|
14
|
+
return await httpResponse(this.responseData, HTTP_STATUS_CODE.NOT_ALLOWED, 'not-allowed.pug');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
17
|
//# sourceMappingURL=notAllowed.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import * as express from 'express';
|
|
3
|
-
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 404 NOT FOUND ERROR
|
|
7
|
-
* @param err - error to send
|
|
8
|
-
*/
|
|
9
|
-
export declare class NotFound extends ErrorResponse {
|
|
10
|
-
constructor(data?: any);
|
|
11
|
-
execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
|
|
12
|
-
}
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 404 NOT FOUND ERROR
|
|
7
|
+
* @param err - error to send
|
|
8
|
+
*/
|
|
9
|
+
export declare class NotFound extends ErrorResponse {
|
|
10
|
+
constructor(data?: any);
|
|
11
|
+
execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=notFound.d.ts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
-
import { httpResponse } from '../responses.js';
|
|
3
|
-
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 404 NOT FOUND ERROR
|
|
7
|
-
* @param err - error to send
|
|
8
|
-
*/
|
|
9
|
-
export class NotFound extends ErrorResponse {
|
|
10
|
-
constructor(data) {
|
|
11
|
-
super(data);
|
|
12
|
-
}
|
|
13
|
-
async execute(_req, _res) {
|
|
14
|
-
return await httpResponse(this.responseData, HTTP_STATUS_CODE.NOT_FOUND, 'notFound.pug');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
3
|
+
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 404 NOT FOUND ERROR
|
|
7
|
+
* @param err - error to send
|
|
8
|
+
*/
|
|
9
|
+
export class NotFound extends ErrorResponse {
|
|
10
|
+
constructor(data) {
|
|
11
|
+
super(data);
|
|
12
|
+
}
|
|
13
|
+
async execute(_req, _res) {
|
|
14
|
+
return await httpResponse(this.responseData, HTTP_STATUS_CODE.NOT_FOUND, 'notFound.pug');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
17
|
//# sourceMappingURL=notFound.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import * as express from 'express';
|
|
3
|
-
import { Response } from '../interfaces.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 200 OK response with json content
|
|
7
|
-
* @param data - data to send
|
|
8
|
-
*/
|
|
9
|
-
export declare class Ok extends Response {
|
|
10
|
-
constructor(data?: any);
|
|
11
|
-
execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
|
|
12
|
-
}
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import { Response } from '../interfaces.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 200 OK response with json content
|
|
7
|
+
* @param data - data to send
|
|
8
|
+
*/
|
|
9
|
+
export declare class Ok extends Response {
|
|
10
|
+
constructor(data?: any);
|
|
11
|
+
execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=ok.d.ts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { HTTP_STATUS_CODE, Response } from '../interfaces.js';
|
|
2
|
-
import { httpResponse } from '../responses.js';
|
|
3
|
-
/**
|
|
4
|
-
* Internall response function.
|
|
5
|
-
* Returns HTTP 200 OK response with json content
|
|
6
|
-
* @param data - data to send
|
|
7
|
-
*/
|
|
8
|
-
export class Ok extends Response {
|
|
9
|
-
constructor(data) {
|
|
10
|
-
super(data);
|
|
11
|
-
}
|
|
12
|
-
async execute(_req, _res) {
|
|
13
|
-
return await httpResponse(this.responseData, HTTP_STATUS_CODE.OK, 'ok.pug');
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
import { HTTP_STATUS_CODE, Response } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
3
|
+
/**
|
|
4
|
+
* Internall response function.
|
|
5
|
+
* Returns HTTP 200 OK response with json content
|
|
6
|
+
* @param data - data to send
|
|
7
|
+
*/
|
|
8
|
+
export class Ok extends Response {
|
|
9
|
+
constructor(data) {
|
|
10
|
+
super(data);
|
|
11
|
+
}
|
|
12
|
+
async execute(_req, _res) {
|
|
13
|
+
return await httpResponse(this.responseData, HTTP_STATUS_CODE.OK, 'ok.pug');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
16
|
//# sourceMappingURL=ok.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as express from 'express';
|
|
2
|
-
import { Response } from '../interfaces.js';
|
|
3
|
-
/**
|
|
4
|
-
* Redirects to another route ( simple alias for request.redirect for api consistency)
|
|
5
|
-
*
|
|
6
|
-
* @param url - url path to another location
|
|
7
|
-
*/
|
|
8
|
-
export declare class Redirect extends Response {
|
|
9
|
-
protected url: string;
|
|
10
|
-
constructor(url: any);
|
|
11
|
-
execute(_req: express.Request, res: express.Response): Promise<void>;
|
|
12
|
-
}
|
|
1
|
+
import * as express from 'express';
|
|
2
|
+
import { Response } from '../interfaces.js';
|
|
3
|
+
/**
|
|
4
|
+
* Redirects to another route ( simple alias for request.redirect for api consistency)
|
|
5
|
+
*
|
|
6
|
+
* @param url - url path to another location
|
|
7
|
+
*/
|
|
8
|
+
export declare class Redirect extends Response {
|
|
9
|
+
protected url: string;
|
|
10
|
+
constructor(url: any);
|
|
11
|
+
execute(_req: express.Request, res: express.Response): Promise<void>;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=redirect.d.ts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Response } from '../interfaces.js';
|
|
2
|
-
/**
|
|
3
|
-
* Redirects to another route ( simple alias for request.redirect for api consistency)
|
|
4
|
-
*
|
|
5
|
-
* @param url - url path to another location
|
|
6
|
-
*/
|
|
7
|
-
export class Redirect extends Response {
|
|
8
|
-
constructor(url) {
|
|
9
|
-
super(null);
|
|
10
|
-
this.url = url;
|
|
11
|
-
}
|
|
12
|
-
async execute(_req, res) {
|
|
13
|
-
res.redirect(this.url);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
import { Response } from '../interfaces.js';
|
|
2
|
+
/**
|
|
3
|
+
* Redirects to another route ( simple alias for request.redirect for api consistency)
|
|
4
|
+
*
|
|
5
|
+
* @param url - url path to another location
|
|
6
|
+
*/
|
|
7
|
+
export class Redirect extends Response {
|
|
8
|
+
constructor(url) {
|
|
9
|
+
super(null);
|
|
10
|
+
this.url = url;
|
|
11
|
+
}
|
|
12
|
+
async execute(_req, res) {
|
|
13
|
+
res.redirect(this.url);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
16
|
//# sourceMappingURL=redirect.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import * as express from 'express';
|
|
3
|
-
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 500 INTERNAL SERVER ERROR
|
|
7
|
-
* @param err - error to send
|
|
8
|
-
*/
|
|
9
|
-
export declare class ServerError extends ErrorResponse {
|
|
10
|
-
constructor(data: any);
|
|
11
|
-
execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
|
|
12
|
-
}
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 500 INTERNAL SERVER ERROR
|
|
7
|
+
* @param err - error to send
|
|
8
|
+
*/
|
|
9
|
+
export declare class ServerError extends ErrorResponse {
|
|
10
|
+
constructor(data: any);
|
|
11
|
+
execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=serverError.d.ts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
-
import { httpResponse } from '../responses.js';
|
|
3
|
-
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 500 INTERNAL SERVER ERROR
|
|
7
|
-
* @param err - error to send
|
|
8
|
-
*/
|
|
9
|
-
export class ServerError extends ErrorResponse {
|
|
10
|
-
constructor(data) {
|
|
11
|
-
super(data);
|
|
12
|
-
}
|
|
13
|
-
async execute(_req, _res) {
|
|
14
|
-
return await httpResponse({ error: this.responseData }, HTTP_STATUS_CODE.INTERNAL_ERROR, 'serverError.pug');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
3
|
+
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 500 INTERNAL SERVER ERROR
|
|
7
|
+
* @param err - error to send
|
|
8
|
+
*/
|
|
9
|
+
export class ServerError extends ErrorResponse {
|
|
10
|
+
constructor(data) {
|
|
11
|
+
super(data);
|
|
12
|
+
}
|
|
13
|
+
async execute(_req, _res) {
|
|
14
|
+
return await httpResponse({ error: this.responseData }, HTTP_STATUS_CODE.INTERNAL_ERROR, 'serverError.pug');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
17
|
//# sourceMappingURL=serverError.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import { fs } from '@spinajs/fs';
|
|
3
|
-
import * as express from 'express';
|
|
4
|
-
import { HTTP_STATUS_CODE, ITemplateResponseOptions, Response } from '../interfaces.js';
|
|
5
|
-
/**
|
|
6
|
-
* HTML resposne with HTML from pug file
|
|
7
|
-
*/
|
|
8
|
-
export declare class TemplateResponse extends Response {
|
|
9
|
-
protected file: string;
|
|
10
|
-
protected status: HTTP_STATUS_CODE;
|
|
11
|
-
protected fsTemplates: fs;
|
|
12
|
-
protected templateFile: string | ITemplateResponseOptions;
|
|
13
|
-
constructor(file: string | ITemplateResponseOptions, model: any, status?: HTTP_STATUS_CODE);
|
|
14
|
-
execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
|
|
15
|
-
}
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import { fs } from '@spinajs/fs';
|
|
3
|
+
import * as express from 'express';
|
|
4
|
+
import { HTTP_STATUS_CODE, ITemplateResponseOptions, Response } from '../interfaces.js';
|
|
5
|
+
/**
|
|
6
|
+
* HTML resposne with HTML from pug file
|
|
7
|
+
*/
|
|
8
|
+
export declare class TemplateResponse extends Response {
|
|
9
|
+
protected file: string;
|
|
10
|
+
protected status: HTTP_STATUS_CODE;
|
|
11
|
+
protected fsTemplates: fs;
|
|
12
|
+
protected templateFile: string | ITemplateResponseOptions;
|
|
13
|
+
constructor(file: string | ITemplateResponseOptions, model: any, status?: HTTP_STATUS_CODE);
|
|
14
|
+
execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
|
|
15
|
+
}
|
|
16
16
|
//# sourceMappingURL=template.d.ts.map
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { DI } from '@spinajs/di';
|
|
2
|
-
import { IOFail } from '@spinajs/exceptions';
|
|
3
|
-
import _ from 'lodash';
|
|
4
|
-
import { HTTP_STATUS_CODE, Response } from '../interfaces.js';
|
|
5
|
-
import { htmlResponse } from '../responses.js';
|
|
6
|
-
/**
|
|
7
|
-
* HTML resposne with HTML from pug file
|
|
8
|
-
*/
|
|
9
|
-
export class TemplateResponse extends Response {
|
|
10
|
-
constructor(file, model, status) {
|
|
11
|
-
super(model);
|
|
12
|
-
this.status = null;
|
|
13
|
-
this.fsTemplates = _.isString(file)
|
|
14
|
-
? DI.resolve('__file_provider__', ['__fs_http_templates__'])
|
|
15
|
-
: DI.resolve('__file_provider__', [file.provider]);
|
|
16
|
-
this.templateFile = file;
|
|
17
|
-
this.status = status;
|
|
18
|
-
}
|
|
19
|
-
async execute(_req, _res) {
|
|
20
|
-
if (!this.fsTemplates) {
|
|
21
|
-
const provider = _.isString(this.templateFile) ? '__fs_http_templates__' : this.templateFile.provider;
|
|
22
|
-
throw new IOFail(`Cannot find template file provider ${provider}. Please check configuration for provider or make sure that __fs_http_templates__ is configured.`);
|
|
23
|
-
}
|
|
24
|
-
this.file = _.isString(this.templateFile)
|
|
25
|
-
? await this.fsTemplates.download(this.templateFile)
|
|
26
|
-
: await this.fsTemplates.download(this.templateFile.template);
|
|
27
|
-
return await htmlResponse(this.file, this.responseData, this.status ? this.status : HTTP_STATUS_CODE.OK);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
import { DI } from '@spinajs/di';
|
|
2
|
+
import { IOFail } from '@spinajs/exceptions';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import { HTTP_STATUS_CODE, Response } from '../interfaces.js';
|
|
5
|
+
import { htmlResponse } from '../responses.js';
|
|
6
|
+
/**
|
|
7
|
+
* HTML resposne with HTML from pug file
|
|
8
|
+
*/
|
|
9
|
+
export class TemplateResponse extends Response {
|
|
10
|
+
constructor(file, model, status) {
|
|
11
|
+
super(model);
|
|
12
|
+
this.status = null;
|
|
13
|
+
this.fsTemplates = _.isString(file)
|
|
14
|
+
? DI.resolve('__file_provider__', ['__fs_http_templates__'])
|
|
15
|
+
: DI.resolve('__file_provider__', [file.provider]);
|
|
16
|
+
this.templateFile = file;
|
|
17
|
+
this.status = status;
|
|
18
|
+
}
|
|
19
|
+
async execute(_req, _res) {
|
|
20
|
+
if (!this.fsTemplates) {
|
|
21
|
+
const provider = _.isString(this.templateFile) ? '__fs_http_templates__' : this.templateFile.provider;
|
|
22
|
+
throw new IOFail(`Cannot find template file provider ${provider}. Please check configuration for provider or make sure that __fs_http_templates__ is configured.`);
|
|
23
|
+
}
|
|
24
|
+
this.file = _.isString(this.templateFile)
|
|
25
|
+
? await this.fsTemplates.download(this.templateFile)
|
|
26
|
+
: await this.fsTemplates.download(this.templateFile.template);
|
|
27
|
+
return await htmlResponse(this.file, this.responseData, this.status ? this.status : HTTP_STATUS_CODE.OK);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
30
|
//# sourceMappingURL=template.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import * as express from 'express';
|
|
3
|
-
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 401 UNAHTORIZED response with json content
|
|
7
|
-
* @param data - data to send
|
|
8
|
-
*/
|
|
9
|
-
export declare class Unauthorized extends ErrorResponse {
|
|
10
|
-
constructor(data: any);
|
|
11
|
-
execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
|
|
12
|
-
}
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 401 UNAHTORIZED response with json content
|
|
7
|
+
* @param data - data to send
|
|
8
|
+
*/
|
|
9
|
+
export declare class Unauthorized extends ErrorResponse {
|
|
10
|
+
constructor(data: any);
|
|
11
|
+
execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=unauthorized.d.ts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
-
import { httpResponse } from '../responses.js';
|
|
3
|
-
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 401 UNAHTORIZED response with json content
|
|
7
|
-
* @param data - data to send
|
|
8
|
-
*/
|
|
9
|
-
export class Unauthorized extends ErrorResponse {
|
|
10
|
-
constructor(data) {
|
|
11
|
-
super(data);
|
|
12
|
-
}
|
|
13
|
-
async execute(_req, _res) {
|
|
14
|
-
return await httpResponse(this.responseData, HTTP_STATUS_CODE.UNAUTHORIZED, 'responses/unauthorized');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
3
|
+
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 401 UNAHTORIZED response with json content
|
|
7
|
+
* @param data - data to send
|
|
8
|
+
*/
|
|
9
|
+
export class Unauthorized extends ErrorResponse {
|
|
10
|
+
constructor(data) {
|
|
11
|
+
super(data);
|
|
12
|
+
}
|
|
13
|
+
async execute(_req, _res) {
|
|
14
|
+
return await httpResponse(this.responseData, HTTP_STATUS_CODE.UNAUTHORIZED, 'responses/unauthorized');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
17
|
//# sourceMappingURL=unauthorized.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import * as express from 'express';
|
|
3
|
-
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 400 BAD REQUEST ERROR
|
|
7
|
-
* @param err - error to send
|
|
8
|
-
*/
|
|
9
|
-
export declare class ValidationError extends ErrorResponse {
|
|
10
|
-
constructor(data: any);
|
|
11
|
-
execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
|
|
12
|
-
}
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 400 BAD REQUEST ERROR
|
|
7
|
+
* @param err - error to send
|
|
8
|
+
*/
|
|
9
|
+
export declare class ValidationError extends ErrorResponse {
|
|
10
|
+
constructor(data: any);
|
|
11
|
+
execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=validationError.d.ts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
-
import { httpResponse } from '../responses.js';
|
|
3
|
-
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 400 BAD REQUEST ERROR
|
|
7
|
-
* @param err - error to send
|
|
8
|
-
*/
|
|
9
|
-
export class ValidationError extends ErrorResponse {
|
|
10
|
-
constructor(data) {
|
|
11
|
-
super(data);
|
|
12
|
-
}
|
|
13
|
-
async execute(_req, _res) {
|
|
14
|
-
return await httpResponse(this.responseData, HTTP_STATUS_CODE.BAD_REQUEST, 'validationError.pug');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
3
|
+
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 400 BAD REQUEST ERROR
|
|
7
|
+
* @param err - error to send
|
|
8
|
+
*/
|
|
9
|
+
export class ValidationError extends ErrorResponse {
|
|
10
|
+
constructor(data) {
|
|
11
|
+
super(data);
|
|
12
|
+
}
|
|
13
|
+
async execute(_req, _res) {
|
|
14
|
+
return await httpResponse(this.responseData, HTTP_STATUS_CODE.BAD_REQUEST, 'validationError.pug');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
17
|
//# sourceMappingURL=validationError.js.map
|
package/lib/mjs/responses.d.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import * as express from 'express';
|
|
2
|
-
import { HTTP_STATUS_CODE } from './interfaces.js';
|
|
3
|
-
/**
|
|
4
|
-
* Sends data & sets proper header as json
|
|
5
|
-
*
|
|
6
|
-
* @param model - data to send
|
|
7
|
-
* @param status - status code
|
|
8
|
-
*/
|
|
9
|
-
export declare function jsonResponse(model: any, status?: HTTP_STATUS_CODE): (_req: express.Request, res: express.Response) => void;
|
|
10
|
-
/**
|
|
11
|
-
* Sends data & sets proper header as json
|
|
12
|
-
*
|
|
13
|
-
* @param model - data to send
|
|
14
|
-
* @param status - status code
|
|
15
|
-
*/
|
|
16
|
-
export declare function textResponse(model: any, status?: HTTP_STATUS_CODE): (_req: express.Request, res: express.Response) => void;
|
|
17
|
-
/**
|
|
18
|
-
* Sends html response & sets proper header. If template is not avaible, handles proper error rendering.
|
|
19
|
-
*
|
|
20
|
-
* @param file - template file path
|
|
21
|
-
* @param model - data passed to template
|
|
22
|
-
* @param status - optional status code
|
|
23
|
-
*/
|
|
24
|
-
export declare function htmlResponse(file: string, model: any, status?: HTTP_STATUS_CODE): (req: express.Request, res: express.Response) => void;
|
|
25
|
-
/**
|
|
26
|
-
* Default response handling. Checks `Accept` header & matches proper response
|
|
27
|
-
* For now its supports html & json responses
|
|
28
|
-
*
|
|
29
|
-
* @param model - data to send
|
|
30
|
-
* @param code - status code
|
|
31
|
-
* @param template - template to render without extension eg. `views/responses/ok`. It will try to match .pug, .xml or whatever to match response
|
|
32
|
-
* to `Accept` header
|
|
33
|
-
*/
|
|
34
|
-
export declare function httpResponse(model: any, code: HTTP_STATUS_CODE, template: string): (req: express.Request, res: express.Response) => void;
|
|
1
|
+
import * as express from 'express';
|
|
2
|
+
import { HTTP_STATUS_CODE } from './interfaces.js';
|
|
3
|
+
/**
|
|
4
|
+
* Sends data & sets proper header as json
|
|
5
|
+
*
|
|
6
|
+
* @param model - data to send
|
|
7
|
+
* @param status - status code
|
|
8
|
+
*/
|
|
9
|
+
export declare function jsonResponse(model: any, status?: HTTP_STATUS_CODE): (_req: express.Request, res: express.Response) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Sends data & sets proper header as json
|
|
12
|
+
*
|
|
13
|
+
* @param model - data to send
|
|
14
|
+
* @param status - status code
|
|
15
|
+
*/
|
|
16
|
+
export declare function textResponse(model: any, status?: HTTP_STATUS_CODE): (_req: express.Request, res: express.Response) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Sends html response & sets proper header. If template is not avaible, handles proper error rendering.
|
|
19
|
+
*
|
|
20
|
+
* @param file - template file path
|
|
21
|
+
* @param model - data passed to template
|
|
22
|
+
* @param status - optional status code
|
|
23
|
+
*/
|
|
24
|
+
export declare function htmlResponse(file: string, model: any, status?: HTTP_STATUS_CODE): (req: express.Request, res: express.Response) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Default response handling. Checks `Accept` header & matches proper response
|
|
27
|
+
* For now its supports html & json responses
|
|
28
|
+
*
|
|
29
|
+
* @param model - data to send
|
|
30
|
+
* @param code - status code
|
|
31
|
+
* @param template - template to render without extension eg. `views/responses/ok`. It will try to match .pug, .xml or whatever to match response
|
|
32
|
+
* to `Accept` header
|
|
33
|
+
*/
|
|
34
|
+
export declare function httpResponse(model: any, code: HTTP_STATUS_CODE, template: string): (req: express.Request, res: express.Response) => void;
|
|
35
35
|
//# sourceMappingURL=responses.d.ts.map
|