Thursday 1 June 2017

Express Serve Static Files Outside of Server Directory

I have had to take over and finish a project done in Nodejs after a coworker left so I know what I have learned in the last 2 days, please excuse my ignorance if this is a simple problem. I have a valid need (insert long unnecessary explanation) to serve a directory of static files that is completely outside of the project. I've tried

app.use('/outsideproject', express.static("C:\\Users\\Public\\Documents\\TheDirectory"))

and it doesn't seem to work. After googling around it doesn't appear I can do it in this way. Are there any other ways? I'd rather keep it all in the project for clarity, but I guess I could get IIS involved to make it work if needed.



via Dave_750

No comments:

Post a Comment