Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Static html application in Heroku

Tags:

html

heroku

cloud

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

like image 624
user4131376 Avatar asked Nov 25 '25 15:11

user4131376


1 Answers

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

like image 81
FPcond Avatar answered Nov 27 '25 06:11

FPcond



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!