forked from fr/deguapp
Working on auth route
This commit is contained in:
parent
3f328e5316
commit
ff8cc4cccf
5
api/src/controllers/authController.ts
Normal file
5
api/src/controllers/authController.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { Request, Response } from "express";
|
||||
|
||||
export function login_post(req: Request, res: Response) {
|
||||
res.send("logged in");
|
||||
}
|
36
api/src/routes/authRoutes.ts
Normal file
36
api/src/routes/authRoutes.ts
Normal 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;
|
@ -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"));
|
||||
|
Loading…
Reference in New Issue
Block a user