mirror of
https://github.com/Raghu-Ch/ReactWeather.git
synced 2026-02-10 03:03:01 -05:00
Prep repo for Heroku
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
"description": "Simple react app",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node server.js"
|
||||
},
|
||||
"author": "Raghu",
|
||||
"license": "MIT",
|
||||
|
||||
12
server.js
12
server.js
@@ -2,9 +2,17 @@ var express = require('express');
|
||||
|
||||
// Create our app
|
||||
var app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
if (req.headers['x-forwarded-proto'] === 'http') {
|
||||
next();
|
||||
} else {
|
||||
res.redirect('http://' + req.hostname + req.url);
|
||||
}
|
||||
});
|
||||
app.use(express.static('public'));
|
||||
|
||||
app.listen(3000, function () {
|
||||
console.log('Express server is up on port 3000');
|
||||
app.listen(PORT, function () {
|
||||
console.log('Express server is up on port ' + PORT);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user