문제

I have a Structure for my application similar to below :

  • ApplicationA
    • a.js
  • ApplicationB
    • b.js
  • ApplicationC
    • c.js
  • public

i have some static file in public directory . how can application a.js that located in ApplicationA directory access to public directory.

도움이 되었습니까?

해결책

var path = require("path")

var target = "../public/"

var resolved = path.relative(__dirname, target)

다른 팁

Do you mean you want to go up a directory? If so use ../ to go up a directory from where you are so for instance if ApplicationA and public are in the same directory you could use:

../public/filename.file
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top