Deploy static files (HTML/CSS/JS) on Heroku

Pulkit Aggarwal
Simple JS
Published in
1 min readSep 21, 2018

--

Heroku is primarily aimed to serve the server level requirements. In general, Heroku support to deploy only these type of applications:

Supported build-packs on Heroku

Clearly, static files (defaults to index.html) can’t be served directly on Heroku. So we need to transform static web app into any of these supported web apps. The simplest alternative is to use Node.js environment.

Here we have a better and simplest option to serve static files on Heroku.

  1. Add package.json file in the root directory.
  2. Add this code in your package.json file:

3. That’s it. Your project is ready to be deployed on Heroku.

serve is a very minimal node package, that is used to serve static files on node server.

--

--