Working on auth route

This commit is contained in:
Filip Rojek 2024-04-29 21:56:25 +02:00
parent 3f328e5316
commit ff8cc4cccf
3 changed files with 43 additions and 2 deletions

View File

@ -0,0 +1,5 @@
import { Request, Response } from "express";
export function login_post(req: Request, res: Response) {
res.send("logged in");
}

View File

@ -0,0 +1,36 @@
import { Router } from "express";
import * as authController from "../controllers/authController";
//import authValidator from "../validators/authValidator";
//import handleValidation from "../middlewares/handleValidation";
//import { requireAuth } from "../middlewares/authMiddleware";
const router = Router();
//const mws = [requireAuth, handleValidation.handleValidationError];
router.post("/login", authController.login_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
//);
export default router;

View File

@ -1,9 +1,9 @@
import { Request, Response, Router } from "express";
import path from "path";
//import authRoutes from "./authRoutes";
import authRoutes from "./authRoutes";
export const router = Router();
//router.use("/api/auth", authRoutes);
router.use("/api/auth", authRoutes);
//router.get("*", (req: Request, res: Response) => {
// res.sendFile(path.join(__dirname, "../views/index.html"));