In the server, how does node get the address bar url?

I can"t get the URL I want by running NODE, on the server

clipboard.png
node

clipboard.png
html
CSS,JS/weatherNODEweather

clipboard.png
I do things like / index.html, / weather/index.html that URL displays different pages.


1 Why does the path not have / weather? for CSS,JS
first, the browser will load html, when it finds that other resources such as css and js, are introduced into the html, and then go to the server to request css and js resources. This path starts from the root directory of the server project, and the static file of your project is placed in the root directory, which naturally starts with / static.

2 Why is there no html file, is there a cache?
see that your css and js are printed on the console. In theory, html must have been loaded, so guess whether the information on the console has been overwritten and you haven't seen it. In addition, you can also console.log (req.url) look at the path of the requested resource

Menu