Sunday, April 30, 2017

Javascript project development with Pow and deployment to Heroku

Serve your project with Pow
Chrome may throw a bunch of errors if you try to run a local JavaScript project just by opening the file(s) in your browser. Third-party library libraries may be blocked due to cross-origin protocol scheme filtering which does not like file://.

One way to get around this is to use Pow to serve the project.

After installing Pow, substitute your project's location following this example:

cd ~/.pow
mkdir soundpound
ln -s /Users/username/projects/soundpound soundpound/public

Deploy to Heroku
When your project's ready to share, deploy it to Heroku!
  1. Create a nodejs project in Heroku
  2. Add heroku/nodejs buildback in Personal apps -> Settings in the Heroku console
  3. Add a package.json file to your application
  4. Push from your git repository to deploy the project to Heroku
Example package.json:

{
  "name": "soundpound",
  "version": "0.1.0",
  "description": "keyboard-driven sound and light show",
  "scripts": {
    "start": "harp server --port $PORT"
  },
  "dependencies": {
    "harp": "*"
  }
}

See https://soundpound.herokuapp.com/