Skip to content

Instantly share code, notes, and snippets.

@blogcacanid
Created November 12, 2020 07:47
Show Gist options
  • Save blogcacanid/10987057f9faaf3bf1fb1305829b470e to your computer and use it in GitHub Desktop.
Save blogcacanid/10987057f9faaf3bf1fb1305829b470e to your computer and use it in GitHub Desktop.
auth.routes.js Authentication JWT Node.js
const { verifyRegister } = require("../middleware");
const controller = require("../controllers/auth.controller");
module.exports = function(app) {
app.use(function(req, res, next) {
res.header(
"Access-Control-Allow-Headers",
"x-access-token, Origin, Content-Type, Accept"
);
next();
});
app.post("/api/auth/register",
[
verifyRegister.checkDuplicateUsernameOrEmail,
verifyRegister.checkRolesExisted
],
controller.register
);
app.post("/api/auth/login", controller.login);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment