Ask coding questions

← Back to all posts
script.js to html link - node.js
somecodingguy

I want that code in script.js to work but its not. Am I linking it wrong?

Voters
somecodingguy
Comments
hotnewtop
themining72

The file is currently just there, you must first add it to the web server.

Add this at line 8 in index.js:

Warning: This method is not very efficient for production, for a bigger project please don't try this, it would work but I don't recommend it.

somecodingguy

@themining72 thank you! You said its not efficient, so is there any other way to do it?

themining72

@somecodingguy The other way is for big projects basically, where you have multiple static files. In this case, refer to this documentation. Also could you set the previous comment above as the answer?