score:0

Accepted answer

the require keyword is used for commonjs modules, but it looks like you've configured node.js to run your application using ecmascript modules. the equivalent way to bring in routes using ecmascript modules is something like:

import { routes } from './routes.js';

bear in mind that you will have to write your routes.js file to be ecmascript modules compatible also, something like:

const routes = [
  ...
];

export { routes }; 

Related Query

More Query from same tag