I am a complete node.js newbie and struggling with the basics.I have a html file and I would like to call external javascript file in the html page using node.js in local host environment.
|
Your main file should check whether the requested url is asking for html or js or css file.
After That you can include external javascript and css files in html files. |
|||
|
You just add the script tag into the html:
|
|||||||||
|
I think I have understood your real interest.
If you are trying to get a script tag (like that one above) working on your html, you should write a "router" inside your Node.js http.createServer callback. When the browser find the script tag, it will send a specific request to the server and then you can send the javascript code back on the response. I have written a way to do it on a similar question here: How to include javascript on client side of node.js?. |
|||
|