Cannot require a script when using express

So I wanted to use express to make a website, I made it so when the user tries to go to localhost:3000 it would response an HTML file, My problem is that when I try to require the index.js file(“const mainscript = require(”…/index.js")) it gives me “Uncaught ReferenceError: require is not defined”, I don’t really understand why it happens, Anyone help?

This forum is about Atom and Electron, so you might have better luck asking the Express community.