Browse Source

🔨 Change cors to only accept localhost:8080

main
Haris Razis 4 years ago
parent
commit
aab2e20e03
  1. 12
      server/index.js

12
server/index.js

@ -13,8 +13,12 @@ const authRoute = require('./routes/auth')
const passport = require('./services/passport'); const passport = require('./services/passport');
const {session_secret} = require('./config/keys'); const {session_secret} = require('./config/keys');
//allow all requests for development. app.use(cors(
app.use(cors()) {
origin: ['http://localhost:8080'],
credentials: true
}
));
app.use(bodyParser.urlencoded({ app.use(bodyParser.urlencoded({
extended: true extended: true
@ -34,6 +38,4 @@ app.use(dataRoute)
app.use(authRoute) app.use(authRoute)
const PORT = process.env.PORT || 8000; const PORT = process.env.PORT || 8000;
server.listen(PORT, () => { server.listen(PORT, () => console.log(chalk.green.bold(`Server listening on port ${PORT}!`)));
console.log(chalk.green.bold(`Server listening on port ${PORT}!`));
});

Loading…
Cancel
Save