diff --git a/api/src/controllers/authController.ts b/api/src/controllers/authController.ts new file mode 100644 index 0000000..7ac1f64 --- /dev/null +++ b/api/src/controllers/authController.ts @@ -0,0 +1,5 @@ +import { Request, Response } from "express"; + +export function login_post(req: Request, res: Response) { + res.send("logged in"); +} diff --git a/api/src/routes/authRoutes.ts b/api/src/routes/authRoutes.ts new file mode 100644 index 0000000..c62cd4e --- /dev/null +++ b/api/src/routes/authRoutes.ts @@ -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; diff --git a/api/src/routes/index.ts b/api/src/routes/index.ts index bf190c9..acf0269 100644 --- a/api/src/routes/index.ts +++ b/api/src/routes/index.ts @@ -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"));