Update server.js with E6 syntax (#101)
server.js updates tested and validated here: https://boilerplate-express.johnsprunger.repl.co Co-authored-by: Muhammed Mustafa <MuhammedElruby@gmail.com>
This commit is contained in:
parent
fb45552535
commit
3d35745103
1 changed files with 9 additions and 9 deletions
18
server.js
18
server.js
|
@ -3,15 +3,15 @@
|
|||
* the verification process may break
|
||||
* ***************************************************/
|
||||
|
||||
var bGround = require('fcc-express-bground');
|
||||
var myApp = require('./myApp');
|
||||
var express = require('express');
|
||||
var app = express();
|
||||
const bGround = require('fcc-express-bground');
|
||||
const myApp = require('./myApp');
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
|
||||
if (!process.env.DISABLE_XORIGIN) {
|
||||
app.use(function(req, res, next) {
|
||||
var allowedOrigins = ['https://narrow-plane.gomix.me', 'https://www.freecodecamp.com'];
|
||||
var origin = req.headers.origin || '*';
|
||||
app.use((req, res, next) => {
|
||||
const allowedOrigins = ['https://narrow-plane.gomix.me', 'https://www.freecodecamp.com'];
|
||||
const origin = req.headers.origin || '*';
|
||||
if(!process.env.XORIG_RESTRICT || allowedOrigins.indexOf(origin) > -1){
|
||||
console.log(origin);
|
||||
res.setHeader('Access-Control-Allow-Origin', origin);
|
||||
|
@ -21,8 +21,8 @@ if (!process.env.DISABLE_XORIGIN) {
|
|||
});
|
||||
}
|
||||
|
||||
var port = process.env.PORT || 3000;
|
||||
bGround.setupBackgroundApp(app, myApp, __dirname).listen(port, function(){
|
||||
const port = process.env.PORT || 3000;
|
||||
bGround.setupBackgroundApp(app, myApp, __dirname).listen(port, () => {
|
||||
bGround.log(`Node is listening on port ${port}...`);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue