I am building a todo app using express framework on node server...I have an index.ejs file as the starting point for my application, In the same folder I put my jquery.min.js file, when I try to include the jquery file as
<script src="jquery.min.js" type="text/javascript"></script>
My app fails to load it, when I see the network in my chrome it looks for
https://localhost:3000/jquery.min.jsHow do I load the file ??
PS: I am accustomed to loading scripts via cloud.google.com by placing the url in the src tag , But I want my application to load faster by this approach
you should create a ./public folder for static files.
add this line to your app.js above all your routes:
app.use(express.static(path.join(__dirname, 'public')));
Then just use this in index.ejs:
<script src="/jquery.min.js"></script>