Node.js server files above root directory

后端 未结 1 947
梦谈多话
梦谈多话 2021-01-27 09:38

I have the following directory structure:

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


        
1条回答
  •  我在风中等你
    2021-01-27 10:34

    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

提交回复
热议问题