Can't Load Javascript and CSS files from Node Js

前端 未结 1 1601
有刺的猬
有刺的猬 2021-01-24 07:42

I have read many questions regarding \"unable to load js and css files from node js\". Looks like a silly path error but since am new to node js, am unable to figure it out. All

相关标签:
1条回答
  • 2021-01-24 08:26

    When node JS gets a request, you pass the requested path into a switch statement.

    If the request is for /socket.html you return an HTML document.

    If the request if for anything else (such as my.js), you return a 404 error.

    You have to return the JS and CSS when it is requested instead of throwing a 404.

    0 讨论(0)
提交回复
热议问题