diff --git a/server/src/controllers/AuthenticationController.js b/server/src/controllers/AuthenticationController.js index 1caaa279434f6edb68b2a9ad9a5fe760a13712aa..dcc129d418696cf2666c9be9488bf5176e2c0eb3 100644 --- a/server/src/controllers/AuthenticationController.js +++ b/server/src/controllers/AuthenticationController.js @@ -1,9 +1,17 @@ +const {User}= require('../models') + + module.exports={ - register(req, res){ - - res.send({ - message: 'hello ${req.body.email} ! Your user was registered! Have fun!' - - }) + async register(req, res){ + + try{ + const user= await User.create(req.body) + res.send(user.toJSON()) + }catch (err){ + res.status(400).send({ + error: 'This email account is already in use.' + }) + } + } } \ No newline at end of file