javascript - How to access any file (html) one level up to localhost path in node.js? -
how can access above file in image localhost:2000/dummy.html
and dummy.html 1 level localhost?
one way:
__dirname + '../' + filename;
__dirname gives path script executing from. appending ../ + filename tell node 1 level in directory path.
you should @ process module in node. lot of environment data exposed through it. e.g. process.env.pwd returns current filesystem path.
Comments
Post a Comment