Introducing external js files and class libraries into html in node.js cannot run

  node.js, question

I use src to introduce external js and libraries in HTML at the same time, which cannot be realized. After that, you can put all the external js into html and run it. What’s the matter?

1. The first sentence of the classmate upstairs is right, you need to build a static server, and the second sentence is wrong, because you will not cross domains if you write like this.
2. If you put the code directly into html, it will certainly be executed, which is certainly no problem. However, if you use an external file, the browser will request this js(kehuduan.js). If you give the address to request, and you don’t see your back-end code, you may not have started the static file service, causing the browser to report a 404 error when requesting this file.
3. However/ file, if you have introduced backstagesocket.ioLibrary, this file is a socket library to help you provide a file service (aop), do not need you to deal with.
4. If you use express backstage, use the following line of code to start the static file service. If your path is correct, you can request your own js

//Provide static file service so that you can find your' kehuduan.js' file

5. Your question and thisProblemMuch like that, you can also refer to it.