I want to link to /node_modules/jade/runtime.min.js
client-side -- how do I make it publicly accessible?
Do I create a app.get
for it somehow?
app.get('/js/jade-runtime.js',<what goes here?>)
Or can I modify the static thing to allow it to be served?
app.use(express.static(path.join(__dirname, 'public'))); // modify this to add more paths somehow
app.get('/js/jade-runtime.js',function(req,res) {
res.sendfile(path.join(__dirname,'node_modules','jade','runtime.min.js'));
});
You can use this with your app.get
.
res.sendfile('jade-runtime.js');
Obviously, use the correct path to where that file is located.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.