@spinajs/http 2.0.57 → 2.0.59
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/config/http.d.ts +57 -1
- package/lib/config/http.d.ts.map +1 -1
- package/lib/config/http.js +8 -8
- package/lib/config/http.js.map +1 -1
- package/package.json +10 -10
package/lib/config/http.d.ts
CHANGED
|
@@ -1,2 +1,58 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import express from 'express';
|
|
3
|
+
import cors from 'cors';
|
|
4
|
+
declare const http: {
|
|
5
|
+
system: {
|
|
6
|
+
dirs: {
|
|
7
|
+
locales: string[];
|
|
8
|
+
templates: string[];
|
|
9
|
+
controllers: string[];
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
cookie: {
|
|
13
|
+
secret: string;
|
|
14
|
+
options: {
|
|
15
|
+
maxAge: number;
|
|
16
|
+
httpOnly: boolean;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
http: {
|
|
20
|
+
port: number;
|
|
21
|
+
middlewares: (express.RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | ((req: cors.CorsRequest, res: {
|
|
22
|
+
statusCode?: number;
|
|
23
|
+
setHeader(key: string, value: string): any;
|
|
24
|
+
end(): any;
|
|
25
|
+
}, next: (err?: any) => any) => void))[];
|
|
26
|
+
/**
|
|
27
|
+
* Default file receiving options
|
|
28
|
+
*/
|
|
29
|
+
Files: {
|
|
30
|
+
MaxSize: number;
|
|
31
|
+
BasePath: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Static files folder. Feel free to override this per app
|
|
35
|
+
*/
|
|
36
|
+
Static: {
|
|
37
|
+
/**
|
|
38
|
+
* virtual prefix in url eg. http://localhost:3000/static/images/kitten.jpg
|
|
39
|
+
*/
|
|
40
|
+
Route: string;
|
|
41
|
+
/**
|
|
42
|
+
* full path to folder with static content
|
|
43
|
+
*/
|
|
44
|
+
Path: string;
|
|
45
|
+
}[];
|
|
46
|
+
/**
|
|
47
|
+
* Whitch accept headers we support (default JSON & HTML)
|
|
48
|
+
*/
|
|
49
|
+
AcceptHeaders: number;
|
|
50
|
+
/**
|
|
51
|
+
* Last resort fatal error fallback template, embedded in code
|
|
52
|
+
* in case if we cannot render any static files
|
|
53
|
+
*/
|
|
54
|
+
FatalTemplate: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export default http;
|
|
2
58
|
//# sourceMappingURL=http.d.ts.map
|
package/lib/config/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/config/http.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/config/http.ts"],"names":[],"mappings":";AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAI9B,OAAO,IAAI,MAAM,MAAM,CAAC;AAwBxB,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;QA8BN;;WAEG;;;;;QAQH;;WAEG;;YAGC;;eAEG;;YAGH;;eAEG;;;QAKP;;WAEG;;QAGH;;;WAGG;;;CAgBN,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/lib/config/http.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const cors = require('cors');
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import helmet from 'helmet';
|
|
3
|
+
import cookieParser from 'cookie-parser';
|
|
4
|
+
import compression from 'compression';
|
|
5
|
+
import cors from 'cors';
|
|
7
6
|
import { join, normalize, resolve } from 'path';
|
|
8
7
|
import { HttpAcceptHeaders } from '../interfaces.js';
|
|
9
8
|
function dir(path) {
|
|
10
|
-
return resolve(normalize(join(
|
|
9
|
+
return resolve(normalize(join(process.cwd(), path)));
|
|
11
10
|
}
|
|
12
11
|
const corsPath = resolve(normalize(join(process.cwd(), 'cors.json')));
|
|
13
12
|
const cOptions = require(corsPath);
|
|
@@ -24,7 +23,7 @@ const corsOptions = {
|
|
|
24
23
|
allowedHeaders: cOptions.allowedHeaders,
|
|
25
24
|
credentials: true,
|
|
26
25
|
};
|
|
27
|
-
|
|
26
|
+
const http = {
|
|
28
27
|
system: {
|
|
29
28
|
dirs: {
|
|
30
29
|
locales: [dir('./../locales')],
|
|
@@ -100,4 +99,5 @@ module.exports = {
|
|
|
100
99
|
</html>`,
|
|
101
100
|
},
|
|
102
101
|
};
|
|
102
|
+
export default http;
|
|
103
103
|
//# sourceMappingURL=http.js.map
|
package/lib/config/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/config/http.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/config/http.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,WAAW,MAAM,aAAa,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,SAAS,GAAG,CAAC,IAAY;IACvB,OAAO,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;AACtE,MAAM,QAAQ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,CAAC,oBAAoB,CAAC;SACpC;QAED;;WAEG;QACH,MAAM,EAAE;YACN;gBACE;;mBAEG;gBACH,KAAK,EAAE,SAAS;gBAEhB;;mBAEG;gBACH,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC;aACxB;SACF;QAED;;WAEG;QACH,aAAa,EAAE,iBAAiB,CAAC,IAAI,GAAG,iBAAiB,CAAC,IAAI;QAE9D;;;WAGG;QACH,aAAa,EAAE;;;;;;;;;;;;;4BAaS;KACzB;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spinajs/http",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.59",
|
|
4
4
|
"description": "framework HTTP module base on express.js",
|
|
5
5
|
"exports": "./lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -52,15 +52,15 @@
|
|
|
52
52
|
"@types/uuid": "^9.0.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@spinajs/configuration": "^2.0.
|
|
56
|
-
"@spinajs/di": "^2.0.
|
|
57
|
-
"@spinajs/exceptions": "^2.0.
|
|
58
|
-
"@spinajs/fs": "^2.0.
|
|
59
|
-
"@spinajs/log": "^2.0.
|
|
60
|
-
"@spinajs/reflection": "^2.0.
|
|
61
|
-
"@spinajs/templates": "^2.0.
|
|
62
|
-
"@spinajs/validation": "^2.0.
|
|
63
|
-
"@spinajs/templates-pug": "^2.0.
|
|
55
|
+
"@spinajs/configuration": "^2.0.59",
|
|
56
|
+
"@spinajs/di": "^2.0.59",
|
|
57
|
+
"@spinajs/exceptions": "^2.0.59",
|
|
58
|
+
"@spinajs/fs": "^2.0.59",
|
|
59
|
+
"@spinajs/log": "^2.0.59",
|
|
60
|
+
"@spinajs/reflection": "^2.0.59",
|
|
61
|
+
"@spinajs/templates": "^2.0.59",
|
|
62
|
+
"@spinajs/validation": "^2.0.59",
|
|
63
|
+
"@spinajs/templates-pug": "^2.0.59",
|
|
64
64
|
"compression": "^1.7.4",
|
|
65
65
|
"cookie-parser": "^1.4.6",
|
|
66
66
|
"cookie-signature": "^1.2.0",
|