const Name =require('path of your model')
app.use('/path', (req,res,next)=>
{
const firstName = req.body.firstName
const lastName = req.body.lastName
const nameData = new Name({firstName:firstName, lastName:lastName});
nameData.save().then(res.redirect('/')).catch(err){
console.log(err);
};
});
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const addittionSchema = new Schema({
firstName:{
type: String,
required: True
},
lastName:{
type: String,
required:True
}
});
module.exports = mongoose.model('budget', addittionSchema);