Is it possible to upload a simple html and javascript file structure to heroku?
Here is a more elegant method: Just add a file called package.json
which tells Heroku to use harp as your server:
{
"name": "my-static-site",
"version": "1.0.0",
"description": "This will load any static html site",
"scripts": {
"start": "harp server --port $PORT"
},
"dependencies": {
"harp": "*"
}
}
and then deploy to Heroku. Done!
Further information: https://harpjs.com/docs/deployment/heroku
You can use rack to do this:
https://devcenter.heroku.com/articles/static-sites-on-heroku
or you can use something like Octopress/Jekyll who uses sinatra.
But you need a minimum stack to serve html static content
A simple way is to masquerade the HTML app as a PHP App. Heroku properly identifies PHP apps.
- Rename your index.html file to home.html.
Create an index.php file and include your entry html file. If your HTML entry file is named home.html as recommended, your index.php should look like:
<?php include_once("home.html"); ?>
In your command line on the machine you are pushing from, type:
git add .
git commit -m 'your commit message'
git push heroku master
Heroku should properly detect your app now as a php app:
-----> PHP app detected
-----> Bundling Apache version 2.2.22
-----> Bundling PHP version 5.3.10
-----> Discovering process types
Procfile declares types -> (none)
Default types for PHP -> web
-----> Compiled slug size: 9.9MB
-----> Launching... done, v3
...
Mad Thanks to lemiffe for his blog post: http://www.lemiffe.com/how-to-deploy-a-static-page-to-heroku-the-easy-way/