Node.js server files above root directory

后端 未结 1 930
梦谈多话
梦谈多话 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 <script src="closure/goog/base.js">.

    0 讨论(0)
提交回复
热议问题