how to use jQuery installed with npm in Express app?

If you want a jquery npm module to be served by an express app then add this line to the server script (in your case app.js):

app.use('/jquery', express.static(__dirname + '/node_modules/jquery/dist/'));

After that you can include it in your html file:

<script src="https://stackoverflow.com/jquery/jquery.js"></script>

Leave a Comment