0👍
✅
we can include a virtual path to the route and then we can access the javascript file as follows.
In Router JS
router.use('/javascript', express.static(path.join(path.dirname(require.main.filename), 'public')));
In Pug Template
script(src='/simple-api/javascript/test.js')
Consider “simple-api” is the public URL.
Source:stackexchange.com