I have a node.js app written in CoffeeScript.
I'm wondering what is needed in order to host the app on Heroku.
Thanks
Michael Blume is right and you don't need any extra code to run CoffeeScript node apps on heroku. This is how I did it:
Add the coffee-script
in the current version to your dependencies in package.json
. This might look somewhat like this:
{ "name": "My-CoffeeScript-App-on-Heroku", "version": "0.0.1", "dependencies": { "coffee-script": "1.1.2" } }
Then modify the entry for your node app in the Procfile
to use coffee instead of node. For an app with only a single web entry this might look like this
web: coffee app.coffee
To test if this will work on Heroku, you can try it on localhost using the foreman gem:
$ gem install foreman $ foreman start 21:13:36 web.1 | started with pid 4711
Then try a push to heroku and you will see something like this in the dependency installation:
-----> Installing dependencies with npm 1.0.8 [email protected] ./node_modules/coffee-script [email protected] ./node_modules/jade ├── [email protected] └── [email protected]
Not sure if there are issues with that procedure but the method described above seems like overkill to me since you're messing up your code for runtime environment stuff.
Hope this helps somebody :)
I was able to get along fine by just including coffeescript in my dependencies and then putting 'coffee index.coffee' in my Procfile
There's a startup cost to compiling each time your server boots, but other than that you should be fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With