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...

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. For now it kind of seems simpler to just do a <?php include_once("home.html"); ?> which seems to work ok
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.
Here's how you create a Procfile - [link] (youtube.com/watch?v=tdLBtkRUKWA)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.