简体   繁体   中英

How to include view related javascript (*.js) files in the views folder in nodejs?

I have been writing all the Javascript code of my html template file within the html file itself but when the logic grows and gets complicated it makes sense to seperately link the javascript script file .

But I am running the node.js express server and the javascript file is not in the public path .

How to whitelist this .js file and what efficient ways are there to included view realted .js files while running a nodejs server.

您可以使用express.static() http://expressjs.com/en/starter/static-files.html以获得更多参考

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM