Skip to content

Instantly share code, notes, and snippets.

@hudaprs
Created July 12, 2020 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hudaprs/54b3c1e2e69cfb26ebea90ffa166d8dd to your computer and use it in GitHub Desktop.
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
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