Estoy tratando de implementar una importación dinámica dentro de un enrutador express.js
ahora tengo un código de abajo
HelloWorldController.js
export const helloWorld = function (req, res) { res.send('hello world') }enrutador.js
export default async function (app) { app.use('/', await ( async function () { const helloWorldController = await import('./helloWorldController.js') const router: express.Router = express.Router() router .get('/', helloWorldController.helloWorld) return router }) }servidor.js
import express from 'express' import router from './router.js' const app = express() router(app) app.listen(3000, function(){ logger.ready(`Web Server is running on port 3000`) })tengo un error 404
GET / 404 18.761 ms - 25esto esta funcionando bien
enrutador.js
import * as helloWorldController './helloWorldController.js' export default async function (app) { app.use('/', await ( async function () { const router: express.Router = express.Router() router .get('/', helloWorldController.helloWorld) return router }) }La sintaxis de importación ES6 aún no es compatible con el nodo js, pruebe esta sintaxis const {express} = require("express")