Search code examples
node.jsfilesystemsdocument-root

Is it possible to set the filesystem root and/or the document root to some subdirectory of the filesystem?


I would like to know if it is possible to specify a subdirectory for the filesystem root or the document root for requests of static resources (if there's any such distinction) in node.js.

I know that I can do it by concatenating an absolute path from the root, but I'm wondering if it can be done on an application-wide level.

I haven't found anything in the documentation supports it, but perhaps I'm overlooking it.


EDIT: I should mention that I'm not interested in using a 3rd party library at this point.


Solution

  • The API does not allow you to do what you're asking for directly. You will need to use string concat.