[英]Open file from route in Express
I have developed a Node module which needs a configuration file (CSV). 我已经开发了一个需要配置文件(CSV)的Node模块。 I am trying to use this module within an Express Route module.
我正在尝试在Express Route模块中使用此模块。 The problem is that the module fails to load the configuration file.
问题是模块无法加载配置文件。
What kind of Path should I use? 我应该使用哪种路径? relative to the module?
相对于模块? relative to the route?
相对于路线? relative to the express project folder?
相对于快递项目文件夹?
I have used the path module to resolve the relative path 我已经使用路径模块来解析相对路径
var url="/relativeDir1/relativeDir2";
var pathModule = require("path");
var path = pathModule.resolve(path.join(__dirname, url));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.