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.
http://expressjs.com/api.html#res.sendfile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With