I have a npm project that uses jquery.
var $ = require(\'jquery\');
I also have an index html file that references bootstrap.
If you have some trouble to use require('jquery')
, there is a more simple way to do it. Just redirect node modules folders (without using any require()
).
app.use('/js', express.static(__dirname + '/node_modules/bootstrap/dist/js')); // redirect bootstrap JS
app.use('/js', express.static(__dirname + '/node_modules/jquery/dist')); // redirect JS jQuery
app.use('/css', express.static(__dirname + '/node_modules/bootstrap/dist/css')); // redirect CSS bootstrap
And on your views, just use simply :