I have an express application which is provided from a module which in turn is located in node_modules like this:
home
user
project
app.js
dist
main.css
an.svg
node_modules
static-webserver
server.js
public
dev
websocket.js
app.js invokes the express static-webserver like this:
require('static-webserver/server.js');
In static-webserver/server.js I am setting two particular paths. One path, which maps /dev to static-websserver's public/dev directory maps like this:
app.use('/dev/', express.static(__dirname + '/public/dev/'));
This path is is working.
But the second path
app.get('/dist', express.static(Path.resolve('dist')));
is not resolving to the dist directory of the application. Path.resolve('dist') should resolve an absolute path /user/project/dist/ but it does not. It always tries to resolve to /home/user/project/node_modules/static-webserver/dist, which is not what I need.
Is there any way to make express static accept absolute paths?