From 0eea9a83089cc12f08520357caa75eeffe0be1a5 Mon Sep 17 00:00:00 2001 From: fabcodingzest <48706652+fabcodingzest@users.noreply.github.com> Date: Fri, 21 Aug 2020 23:31:56 +0530 Subject: [PATCH] Added some comments for routes in user.js #46 --- routes/api/user.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/routes/api/user.js b/routes/api/user.js index adaa9c4..4efffba 100644 --- a/routes/api/user.js +++ b/routes/api/user.js @@ -8,12 +8,15 @@ const { ensureGuest } = require("../../middleware/auth"); // Load User Model const User = require("../../models/User"); -// Sign Up Page +// @desc Sign Up Page +// @route GET /user/signup +// @access Public router.get('/signup', ensureGuest, (req, res) => { res.status(200).render('signup', { layout: 'layouts/login' }) }) -// Submit Sign Up Form +// @desc Submit Sign Up Form +// @route GET /user/signup router.post('/signup', (req, res) => { const { firstName, lastName, password1, password2, email } = req.body; let errors = []; @@ -62,6 +65,8 @@ router.post('/signup', (req, res) => { } }) +// @desc Submit Sign In Form +// @route GET /user/signin router.post('/signin', (req, res, next) => { passport.authenticate('local', { successRedirect: '/portfolio',