Hack to Deploy JavaScript App on Heroku

0

Note: I’m assuming that you know how to deploy apps on Heroku by Git Commands.

Those who are familiar with Heroku knows that Heroku don’t have any build pack for JavaScript app which takes care all the dependencies for the app. In this ‘how to’ tutorial, I will explain a great hack that how to deploy  JavaScript app on Heroku. For those who don’t know what Heroku is can refer to this link here

This hack to deploy javascript app on Heroku is magical, you would definitely love it when you will deploy your app based on HTML, CSS, and JavaScript as a PHP App on Heroku

So let’s get started.

Suppose you have “Text To Speech App” with only three files, HTML, CSS and JavaScript as mentioned below

app files screenshot

App files screenshot

Now to deploy this app on Heroku, we need to pretend it like a PHP app. Because Heroku have a build pack for PHP apps and this is a great hack!

For this we need to create two files, index.php and composer.json as given below.

Index.php

In index.php include the following code

<?php

Include_once(“index.html”);

?>

index.php

index.php

Composer.json

Add the pair of braces {}

composer.json

composer.json

Save the both files and deploy the javascript app on Heroku by using git commands

Congratulations! You are done here!

If you don’t know how to deploy apps on Heroku by git, please see the tutorial here

Share.

About Author

Leave A Reply