Skip to content

Commit

Permalink
Refactor security middleware in app.js
Browse files Browse the repository at this point in the history
  • Loading branch information
victorKariuki committed Oct 5, 2024
1 parent 96f7765 commit 05e3dd3
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const express = require("express");
const path = require("path");
const cookieParser = require("cookie-parser");
const logger = require("morgan");
const helmet = require("helmet"); // Security middleware
// const helmet = require("helmet"); // Security middleware
const indexRouter = require("./routes/index");

const app = express();
Expand All @@ -18,14 +18,14 @@ app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, "public")));
app.use(
helmet.contentSecurityPolicy({
directives: {
defaultSrc: ["'self'"],
scriptSrc: ["'self'", "https://cdn.socket.io"],
},
})
); // Apply security middleware
// app.use(
// helmet.contentSecurityPolicy({
// directives: {
// defaultSrc: ["'self'"],
// scriptSrc: ["'self'", "https://cdn.socket.io"],
// },
// })
// ); // Apply security middleware

// Routes setup
app.use("/", indexRouter);
Expand Down

0 comments on commit 05e3dd3

Please sign in to comment.