Why dosent node.js work on my website?
both these images ^ are from the html repl
this ^ is from the node.js repl
so, i made a node.js server for my html website, but it says that require is not defined, in another repl, i used the same website but set the language to node.js and it works, except the problem is that it messes up everything.. does anyone know what i can do to either fix this on my html repl or on the node.js repl?
node.JS is supposed to be run from a server, the HTML repl is a static file server, so no code is run before it is sent to the client. If you want to use node.js, you need to use a node.js repl.
@Xenity with a node.js repl you need to also serve the files that you want your site to use, your site can't just ask for styles.css if the server doesn't know what to send when it receives that request. You need to use a thing called Static File serving, which is an option available in Express