floranet/api/controller/Contact/contact.controller.js

22 lines
496 B
JavaScript

const db = require("../../db/db");
class ContactController {
async Create(req, res) {
try {
const { name, phone, email, message } = req.body;
const contact = await db.contact_Request(name, phone, email, message);
return res.status(200).send({
data: contact[0]
})
} catch (error) {
console.log(error);
return res.status(422).send({
message: "error al guardar contacto"
})
}
}
}
module.exports = new ContactController();