3

I am wondering if there is a way to deploy a static html application to heroku without disguising it as a php application.

I have it working using the following answer. Is it possible to upload a simple html and javascript file structure to heroku?

However I find it odd that you can't just send up a straight html application. Especially since it's a common use case to just have a simple html app act as a shell for SPAs

Anyone know of a way to do this. I get the error Heroku push rejected, no Cedar-supported app detected if I try without the php disguise trick...

Community
  • 1
  • 1
user4131376
  • 65
  • 10

1 Answers1

3

The way I have done this is just by using the node.js build.

Just throw this in the index.js and put all your files in the /public folder under your main app folder.

var express = require('express');
var app = express();

app.set('port', (process.env.PORT || 5000));
app.use(express.static(__dirname + '/public'));

app.listen(app.get('port'), function() {
  console.log("Node app is running at localhost:" + app.get('port'))
});

Make a Procfile with

web: node index.js

And make a basic Package file which can be done w/ npm

I have an angularjs site running with that with all my dependencies in /public

Omar Al-Ithawi
  • 4,988
  • 5
  • 36
  • 47
FPcond
  • 581
  • 2
  • 7
  • 21
  • Thanks. For now it kind of seems simpler to just do a which seems to work ok – user4131376 Oct 13 '14 at 00:16
  • 1
    very true, but if you want to do an API call in your code you might want to store the key on the server and use an Ajax call which is the main reason I want to this as a solution. – FPcond Oct 13 '14 at 03:08
  • Here's how you create a Procfile - [link] (https://www.youtube.com/watch?v=tdLBtkRUKWA) – Mr T Jul 24 '17 at 22:53