When I save something to the bd (MongoDB) from the app, I close the node server in the terminal, however it saves the data.
I have in the file api_v1.js:
const express = require('express');
const router = express.Router();
const Profesor = require('../models/profesor');
router.post('/profesores', (req, res) => {
delete req.body._id;
Profesor.create(req.body, (err, Profesor) =>{
if(err){
res.json(err)
}else{
res.json(profesor);
}
});
});
On the browser terminal:
Source map error: TypeError: NetworkError when attempting to fetch resource.
Resource URL: http://localhost:3000/main.bundle.js
Source Map URL: main.bundle.map[Learn More]
In the node console it says:
C:\Users\leand\Documents\Universidad\Software III\PracticasProyecto\colegio-crud-app\node_modules\mongodb\lib\utils.js:132
throw err;
^
ReferenceError: profesor is not defined
at Profesor.create (C:\Users\leand\Documents\Universidad\Software III\PracticasProyecto\colegio-crud-app\routes\api_v1.js:20:22)
at Function.<anonymous> (C:\Users\leand\Documents\Universidad\Software III\PracticasProyecto\colegio-crud-app\node_modules\mongoose\lib\model.js:3954:16)...