mirror of
https://github.com/Raghu-Ch/ReactWeather.git
synced 2026-02-10 11:03:02 -05:00
Prep repo for Heroku
This commit is contained in:
@@ -4,7 +4,8 @@
|
|||||||
"description": "Simple react app",
|
"description": "Simple react app",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"start": "node server.js"
|
||||||
},
|
},
|
||||||
"author": "Raghu",
|
"author": "Raghu",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
12
server.js
12
server.js
@@ -2,9 +2,17 @@ var express = require('express');
|
|||||||
|
|
||||||
// Create our app
|
// Create our app
|
||||||
var app = express();
|
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.use(express.static('public'));
|
||||||
|
|
||||||
app.listen(3000, function () {
|
app.listen(PORT, function () {
|
||||||
console.log('Express server is up on port 3000');
|
console.log('Express server is up on port ' + PORT);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user