1
0
forked from fr/deguapp

Added: api auth status

This commit is contained in:
Filip Rojek 2024-05-02 01:19:44 +02:00
parent de8ff025fa
commit cdc5970b3a
2 changed files with 3 additions and 30 deletions

View File

@ -2,38 +2,13 @@ import { Router } from "express";
import * as authController from "../controllers/authController";
import validate from '../middlewares/validateRequest'
import * as AuthVal from '../validators/authValidator'
//import handleValidation from "../middlewares/handleValidation";
import { requireAuth } from "../middlewares/authMiddleware";
const router = Router();
//const mws = [requireAuth, handleValidation.handleValidationError];
router.post("/auth/signup",validate(AuthVal.signup) , authController.signup_post);
router.post("/auth/signin",validate(AuthVal.signin) , authController.signin_post);
router.post("/auth/logout", requireAuth, authController.logout_post);
//router.post(
// "/login",
// authValidator.checkUserLogin(),
// handleValidation.handleValidationError,
// userController.login_post
//);
//router.post(
// "/register",
// authValidator.checkUserRegister(),
// handleValidation.handleValidationError,
// userController.register_post
//);
//router.post("/logout", userController.logout_post);
//router.post(
// "/edit",
// [requireAuth],
// authValidator.checkChange(),
// userController.edit_post
//);
router.get("/auth/status", requireAuth, authController.status_get);
export default router;

View File

@ -207,7 +207,6 @@ describe('POST /api/v1/auth/logout', () => {
});
});
/*
describe('GET /api/v1/auth/status', () => {
const url = '/api/v1/auth/status';
test('should return login status 401', async () => {
@ -220,4 +219,3 @@ describe('GET /api/v1/auth/status', () => {
expect(res.statusCode).toBe(200);
});
});
*/