UNPKG

@replyke/express

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

24 lines (23 loc) 1.56 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const express_1 = require("express"); const auth_1 = require("../controllers/auth"); const rateLimit_1 = require("../../utils/rateLimit"); const requireUserAuth_1 = __importDefault(require("../../middleware/requireUserAuth")); const router = (0, express_1.Router)(); // Register a new user router.post("/sign-up", (0, rateLimit_1.rateLimiter)("5m", 5, "Too many sign up attempts, please wait 5 minutes"), auth_1.signUp); // Sign a user in router.post("/sign-in", (0, rateLimit_1.rateLimiter)("5m", 5, "Too many sign in attempts, please wait 5 minutes"), auth_1.signIn); // Log a user out router.post("/sign-out", (0, rateLimit_1.rateLimiter)("5m", 5, "Too many sign out attempts, please wait 5 minutes"), auth_1.signOut); // Change a user password router.post("/change-password", (0, rateLimit_1.rateLimiter)("5m", 5, "Too many attempts to change password, please wait 5 minutes"), requireUserAuth_1.default, auth_1.changePassword); // Use refresh token to issue a new access token router.post("/request-new-access-token", (0, rateLimit_1.rateLimiter)("5m", 50, "Too many attempts to request a new access token, please wait 5 minutes"), auth_1.requestNewAccessToken); // Use refresh token to issue a new access token router.post("/verify-external-user", (0, rateLimit_1.rateLimiter)("5m", 50), auth_1.verifyExternalUser); exports.default = router;