@cortec/polka
Advanced tools
Comparing version 1.11.2 to 1.12.0
@@ -24,2 +24,3 @@ "use strict"; | ||
const compression_1 = __importDefault(require("compression")); | ||
const cors_1 = __importDefault(require("cors")); | ||
const helmet_1 = __importDefault(require("helmet")); | ||
@@ -94,2 +95,4 @@ const polka_1 = __importDefault(require("polka")); | ||
app.use((0, helmet_1.default)(polkaConfig?.helmet)); | ||
// Setup cors for endpoint | ||
app.use((0, cors_1.default)(polkaConfig?.cors)); | ||
// Setup compression | ||
@@ -96,0 +99,0 @@ app.use((0, compression_1.default)(polkaConfig?.compression)); |
@@ -11,3 +11,4 @@ /// <reference types="node" /> | ||
static create<T>(body: T, status?: HttpStatusCode): Response<T>; | ||
static text(body: string, status?: HttpStatusCode, headers?: http.OutgoingHttpHeaders): Response<string>; | ||
static json<T>(body: T, status?: HttpStatusCode, headers?: http.OutgoingHttpHeaders): Response<T>; | ||
} |
@@ -16,2 +16,8 @@ "use strict"; | ||
} | ||
static text(body, status = HttpStatusCodes_1.default.OK, headers) { | ||
return new Response(body, status, { | ||
'content-type': 'text/plain', | ||
...headers, | ||
}); | ||
} | ||
static json(body, status = HttpStatusCodes_1.default.OK, headers) { | ||
@@ -18,0 +24,0 @@ return new Response(body, status, { |
{ | ||
"name": "@cortec/polka", | ||
"version": "1.11.2", | ||
"version": "1.12.0", | ||
"description": "<description>", | ||
@@ -29,4 +29,6 @@ "main": "dist/index.js", | ||
"@types/compression": "^1.7.2", | ||
"@types/cors": "^2.8.17", | ||
"body-parser": "^1.20.2", | ||
"compression": "^1.7.4", | ||
"cors": "^2.8.5", | ||
"helmet": "^6.0.1", | ||
@@ -52,3 +54,3 @@ "polka": "^0.5.2", | ||
}, | ||
"gitHead": "d1077b74845b1a5260c2a5687150af373bba008c" | ||
"gitHead": "8cf0d794677a0ba2b2ff3595014b242732bce914" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57555
1112
12
+ Added@types/cors@^2.8.17
+ Addedcors@^2.8.5
+ Added@types/cors@2.8.17(transitive)
+ Addedcors@2.8.5(transitive)
+ Addedobject-assign@4.1.1(transitive)