i am rohn

thoughtfully linking code

Backbone.js With Pow

I found myself in a situation where I needed to serve a static site (in reality a Backbone.js webapp) through my running Pow! installation. The solution was extremely easy to find but I thought I’d list it here anyway.

The documentation indicates that your folder structure must include a public folder inside your project folder. This would have conflicted with the directory structure of the application that I’m contributing to, so I simply wrapped my project folder with a company folder, which in turn holds the public folder:

1
/Users/username/Sites/mycompany/public/myproject

or another way to view that is:

1
2
3
4
5
/Users/username/Sites/
  mycompany/
    public/
      myproject/
      myotherproject/

You still need to create the symbolic link from your site’s directory

1
2
cd ~/.pow
ln -s ~/Sites/mycompany

and now you simply access your static site via:

1
http://mycompany.dev/myproject/

Of course the easiest (perhaps better) solution is to install the powder gem and manually bring down the pow server when working on your non-pow projects.