Skip to content

Commit

Permalink
Refactor app.js to remove unnecessary CORS headers and security measures
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-dalby committed Oct 23, 2024
1 parent 774277b commit b941a26
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions server/src/app.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const cors = require('cors');
const { initializeDatabase } = require('./config/database');
const snippetRoutes = require('./routes/snippetRoutes');

const app = express();
const port = process.env.PORT || 5000;

app.use(cors({
origin: true,
credentials: true
}));

app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, '../../client/build')));

app.set('trust proxy', true);
app.use((req, res, next) => {
res.header('X-Powered-By', null);
res.header('X-Frame-Options', 'SAMEORIGIN');
res.header('X-Content-Type-Options', 'nosniff');
next();
});

app.use('/api/snippets', snippetRoutes);

Expand Down

0 comments on commit b941a26

Please sign in to comment.