Node.js server files above root directory

I have the following directory structure:

limejs/
  closure/
    closure/
      goog/
        base.js
  projects/
    myGame/
      myGame.html
      server.js

I call "node server.js" in "cd limejs/projects/myGame". When I serve myGame.html, I want base.js to be included. Here's the script include from myGame.html:

<script type="text/javascript" src="../../closure/closure/goog/base.js"></script>

The GET attempt is on localhost:8080/closure/closure/goog/base.js. I know that if I put my server code a couple of directories higher, I can access the base.js via:

<script type="text/javascript" src="/closure/closure/goog/base.js"></script>

But I'd like to keep all of the "myGame" related code in the same folder while experimenting. Is this possible?

You're probably using express.static(dir). Files are only served from dir down, everything else is invisible. Same goes for any other static file server (Apache, ningx, etc).

You need to either serve files from higher in the directory tree, so that closure/closure/goog/base.js is accessible (from limejs in this case), or copy/link the files into your game folder.

If you're on linux/mac, ln -s closure/closure projects/myGame/closure should do the trick, then you can include <script src="closure/goog/base.js">.