Disclaimer: I\'m a node.js/grunt/bower newbie.
I have a node.js/grunt/bower application that I\'m trying to deploy on Heroku. Heroku builds the application as expect
Thanks for the answer. After trying the tutorial mentioned above and looking at the solutions in node.js TypeError: path must be absolute or specify root to res.sendFile [failed to parse JSON] I ended up writing a server.js file which solved the problem. And it looks like this:
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.sendFile(__dirname + '/index.html');
});
app.get(/^(.+)$/, function (req, res) {
res.sendFile(__dirname + req.params[0]);
});
var PORT = process.env.PORT || 3000;
app.listen(PORT);
npm start
is the default web
process run when no other process has been specified in a Procfile. Since you say you don't want a server (a web
process), the first thing to do is to scale the default process to zero:
heroku scale web=0
Next, you'll want to tell Heroku what process you want to run instead of web
by adding its process types to a file called Procfile
. For instance, if your app starts with node foobar.js
, you could create a Procfile
that looks like:
bot: node foobar.js
Then scale the 'bot' process up to at least one:
heroku scale bot=1
Looking at your code above, even though you say it isn't a server-based application, it looks very much like a server-based application. How do you start your app locally? Whatever the answer that should probably go into the Procfile
, which you can learn more about here:
disclosure: I'm the Node.js platform owner at Heroku