Has anyone deployed a web app to Heroku? I’ve been trying for a while to get my Ionic web app live on Heroku. I’ve followed some tutorials but get the same result. “Web process failed to bind to $PORT within 60 seconds of launch” I’ve followed these tutorials:
- How to Deploy Hybrid Mobile App using Ionic Framework on Heroku
- How to Deploy Ionic Apps as Website to Heroku
Also I’ve searched a lot on stack overflow and none of the solutions on here have helped me out yet.
Here is my server.js at the root of my project
var express = require('express');
var app = express();
var morgan = require('morgan');
var bodyParser = require('body-parser');
var cors = require('cors');
var path = require('path');
const PORT = process.env.PORT || 5000
app.use(morgan('dev'));
app.use(bodyParser.urlencoded({'extended':'true'}));
app.use(bodyParser.json());
app.use(cors());
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header('Access-Control-Allow-Methods', 'DELETE, PUT');
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.use(express.static(path.resolve(__dirname, "www")));
app.set('port', PORT);
app.listen(app.get('port'), function() {
console.log("listening to Port", app.get("port"));
});
And here is my Procfile:
web: npm run build && npm start
I’m not sure what other files to include so just let me know what to add to the post. Thanks in advance.