Tag: express

  • How can I import a route file using Express?

    How can I import a route file using Express?

    0 Normally when I make a server I have no problem importing route files but I’m working on a project using GraphQL which requires me to include "type": "module", inside my package.json file. So when I try having this inside my app.js file const indexRouter = require("./routes/index"); It gives me this error. ReferenceError: require is…