Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 asp.net 中,我可以使用 Server.MapPath("~/") 来获取我的应用程序的根路径。我可以通过 process.env 或任何其他方法访问任何环境变量来获取 node.js 中的根路径吗?我正在使用 iisnode。
谢谢
有不止一种方法可以做到这一点:
__dirname - 当前模块的目录
__dirname
__filename- 当前模块的完整路径
__filename
process.cwd()- 应用程序的工作目录
process.cwd()