Skip to content

Commit

Permalink
add security
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuyog2 committed Nov 9, 2022
1 parent 1e6f065 commit 88ae7c6
Show file tree
Hide file tree
Showing 3 changed files with 951 additions and 1 deletion.
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ const express = require("express");
const bodyParser = require("body-parser");
var cors = require("cors");
const { MongoClient } = require("mongodb");
const helmet = require('helmet');
const morgan = require('morgan');

const app = express();

// create application/json parser
Expand Down Expand Up @@ -54,6 +57,11 @@ const corsOptionsDelegate = (req, callback) => {
callback(null, corsOptions);
};
app.use(cors(corsOptionsDelegate));

app.use(helmet());

app.use(morgan('combined'));

app.listen(process.env.PORT || 3000, () => {
console.log(`Example app listening on port ${process.env.PORT}!`);
});
Loading

0 comments on commit 88ae7c6

Please sign in to comment.