Skip to content

Commit 6171f46

Browse files
author
Yakshit chhipa
committed
feat: helmet options
1 parent 6351772 commit 6171f46

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/chconf.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
import { OutgoingHttpHeader } from "http";
2+
13
export interface config {
24
rootEndPoint: string;
35
TS: boolean;
46
port: string;
57
staticRoot: string;
68
resolvePath:string;
79
cacheRequests:boolean;
10+
helmetConfig: OutgoingHttpHeader | any;
811
}
12+
913
export function chconf() : Promise<config>
1014
export function whiteMessage() : void
1115
export function warning() : void

src/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ async function BlazeInit() {
4444
port: port,
4545
staticRoot: staticRoot,
4646
resolvePath:resolvePath,
47-
cacheRequests:cache
47+
cacheRequests:cache,
48+
helmetConfig:{}
4849
}, null, 4)}`);
4950

5051
writeFileSync("package.json", JSON.stringify(getPackageJson(TS,name), null, 4))

src/dev.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#!/usr/bin/env node
22
import express from "express";
33
import { existsSync, mkdirSync, readFileSync, watch, writeFileSync } from "fs";
4+
import helmet from "helmet";
45
import { chconf, errorRed, infoGreyDev, warning, safe, danger } from "./chconf.js"
56
import { revalidateCache } from "./cache.js";
67

78
const config = await chconf()
8-
const app = express();
9+
const app = express(helmet(config.helmetConfig ?? undefined));
910

1011
// Extend the response object's prototype
1112
express.response.logResponse = function (reqQuery,reqParams,body,route,method) {

0 commit comments

Comments
 (0)