Created
July 12, 2020 14:24
-
-
Save hudaprs/54b3c1e2e69cfb26ebea90ffa166d8dd to your computer and use it in GitHub Desktop.
Medium - NodeJS - Make Full Authentication API - With JWT, MongoDB & JWT - Full auth route
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const router = require("express").Router(); | |
// Controllers | |
const { | |
register, | |
verify, | |
login, | |
resendVerification, | |
getAuthenticatedUser, | |
} = require("../../app/controllers/api/AuthController"); | |
// Middleware | |
const { | |
registerValidation, | |
loginValidation, | |
auth, | |
} = require("../../app/middlewares/auth"); | |
// Routes | |
router.post("/register", registerValidation, register); | |
router.get("/verify/:token", verify); | |
router.post("/login", loginValidation, login); | |
router.post("/verify/resend", resendVerification); | |
router.get("/", auth, getAuthenticatedUser); | |
module.exports = router; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment