pessoasRoute
const { Router } = require('express');
const PessoaController = require('../controllers/PessoaController');
const router = Router();
router.get('/pessoas', PessoaController.pegaTodasAsPessoas);
module.exports = router;
index.js
const bodyParser = require('body-parser');
const pessoas = require('./pessoasRoute')
module.exports = app => {
app.use(bodyParser.json());
app.use(pessoas);
}
O erro que dá é
const model = sequelize['import'](path.join(__dirname, file));
^
TypeError: sequelize.import is not a function
at D:\Documentos\Dev\Alura\ORM com NODEJS\api\models\index.js:24:38
at Array.forEach (<anonymous>)
at Object.<anonymous> (D:\Documentos\Dev\Alura\ORM com NODEJS\api\models\index.js:23:4)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (D:\Documentos\Dev\Alura\ORM com NODEJS\api\controllers\PessoaController.js:1:18)
Node.js v18.12.1
[nodemon] app crashed - waiting for file changes before starting...