I'm making LoopBack application and I wonder how I can use coffeescript on serverside, so I could use slc run
?

- 44,692
- 7
- 66
- 118

- 3,071
- 2
- 24
- 28
2 Answers
I've used LoopBack recently, and wrote the backend code in coffeescript. The catch is that you can't use the slc run
command to run it. Instead, after generating the initial application skeleton with slc
, rewrite your main server file in coffeescript. The quickest way to do that is probably to convert it with js2coffee:
npm install -g js2coffee
js2coffee server/server.js > server/server.coffee
rm server/server.js
Then kickoff your LoopBack server using coffee
instead of slc run
npm install -g coffee-script
coffee server/server.coffee
This starts the server just like any other node.js app, and you get to write any of your server files in coffeescript, without needing to precompile them first with grunt
, etc.
If you feel like you're missing out on some of the bonus features of slc run
like clustering and process monitoring, you could try pm2 as a generalized alternative. It supports coffeescript out of the box. Hopefully in the future (hint hint, StrongLoop), the slc
tool will, too.

- 369
- 3
- 7
looking at the getting started guide for strongloop it looks like it depends on yeoman and grunt, so, I'd just use grunt to compile your cs to js when the build process runs. grunt-contrib-coffee would be a good place to start.
http://docs.strongloop.com/display/SLC/Getting+started+with+StrongLoop+Controller https://github.com/gruntjs/grunt-contrib-coffee

- 14,085
- 4
- 35
- 46