aboutsummaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
Diffstat (limited to 'server.js')
-rw-r--r--server.js20
1 files changed, 4 insertions, 16 deletions
diff --git a/server.js b/server.js
index 49d8579..c64bf8c 100644
--- a/server.js
+++ b/server.js
@@ -8,23 +8,11 @@ const routes = require("./routes");
// Create the server
const app = express();
app.use(function (req, res, next) {
- // Website you wish to allow to connect
- res.setHeader("Access-Control-Allow-Origin", "http://localhost:3000", "https://thatcomputerscientist.com");
-
- // Request methods you wish to allow
- res.setHeader(
- "Access-Control-Allow-Methods",
- "GET, POST, OPTIONS, PUT, PATCH, DELETE"
- );
-
- // Request headers you wish to allow
- res.setHeader(
- "Access-Control-Allow-Headers",
- "X-Requested-With,content-type"
- );
-
- // Pass to next layer of middleware
+ // Only allow http://localhost:3000 and https://thatcomputerscientist.com to access the API
+ res.header("Access-Control-Allow-Origin", "http://localhost:3000");
+ res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
+
});
app.use(function (req, res, next) {
if (