Commit inicial

This commit is contained in:
2025-05-13 14:28:19 -04:00
commit 3d579f5e01
15 changed files with 1558 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
const User = require("../models/User");
const getHome = async function(req, res, next) {
try {
res.send("Aqui é a home")
} catch (error) {
res.status(500).send("Não foi encontrado usuários")
}
}
module.exports = { getHome }

View File

@@ -0,0 +1,24 @@
const User = require("../models/User");
const listUsers = async (req, res) => {
try {
const users = await User.find();
res.json(users)
} catch (error) {
res.status(500).send("Erro ao carregar usuários");
}
}
const createtUser = async (req, res) => {
try {
const user = new User(req.body);
const newUser = await user.save();
res.json(newUser);
} catch (error) {
res.status(500).send("Erro ao salvar usuários");
}
}
module.exports = { listUsers, createtUser }