Created
September 2, 2016 10:02
-
-
Save zacck-zz/e4298f0028988866fe40529cf9fd87c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//load module | |
var express = require('express'); | |
//create our app | |
var app = express(); | |
const PORT = process.env.PORT || 3000; | |
//HTTPS TO HTTP | |
app.use(function (req, res, next){ | |
/*if over http | |
if(req.headers['x-forwarded-proto'] === 'http') { | |
res.redirect('https://'+req.hostname +req.url); | |
} else { | |
next(); | |
} | |
*/ | |
}); | |
//show app folder to serve | |
app.use(express.static('public')); // specifies a a folder name to expose | |
//start the server | |
app.listen(PORT, function(){ // takes the port you are serving to and a function | |
console.log('Express Server is up on port ' + PORT);//log top console | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment