const Atendimento = require('../models/atendimentos')
module.exports = app => {
app.get('/atendimentos', (req,res) => res.send('ok'));
app.post('/atendimentos', (req,res) => {
const atendimento = req.body
Atendimento.add(atendimento)
res.send('Post atendimento')}
)
}
module.exports = new Atendimento
O erro:
- .\controllers\atendimentos.js C:\Sara\node\node_modules\mysql\lib\protocol\Parser.js:437 throw err; // Rethrow non-MySQL errors ^
TypeError: Atendimento is not a constructor at Object. (C:\Sara\node\controllers\atendimentos.js:19:18) at Module.compile (internal/modules/cjs/loader.js:1068:30) at Object.Module.extensions..js (internal/modules/cjs/loader.js:1097:10) at Module.load (internal/modules/cjs/loader.js:933:32) at Function.Module.load (internal/modules/cjs/loader.js:774:14) at Module.require (internal/modules/cjs/loader.js:957:19) at require (internal/modules/cjs/helpers.js:88:18) at Consign.into (C:\Sara\node\nodemodules\consign\lib\consign.js:232:15) at module.exports (C:\Sara\node\config\customExpress.js:16:14) at Handshake. (C:\Sara\node\index.js:13:21) [nodemon] app crashed - waiting for file changes before starting...