diff --git a/src/endpoints/AuthPoint.ts b/src/endpoints/AuthRestResource.ts similarity index 100% rename from src/endpoints/AuthPoint.ts rename to src/endpoints/AuthRestResource.ts diff --git a/src/endpoints/CompactRecipePoint.ts b/src/endpoints/CompactRecipeRestResource.ts similarity index 100% rename from src/endpoints/CompactRecipePoint.ts rename to src/endpoints/CompactRecipeRestResource.ts diff --git a/src/endpoints/RecipePoint.ts b/src/endpoints/RecipeRestResource.ts similarity index 100% rename from src/endpoints/RecipePoint.ts rename to src/endpoints/RecipeRestResource.ts diff --git a/src/endpoints/UserPoint.ts b/src/endpoints/UserRestResource.ts similarity index 100% rename from src/endpoints/UserPoint.ts rename to src/endpoints/UserRestResource.ts diff --git a/src/index.ts b/src/index.ts index 070f409..7c917f4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,10 +7,10 @@ import { errorLoggerMiddleware } from "./middleware/errorLoggerMiddleware.js"; import { corsHeaders } from "./middleware/corsMiddleware.js"; import { logger } from "./utils/logger.js"; import { HttpStatusCode } from "./apiHelpers/HttpStatusCodes.js"; -import authRoutes, { authBasicRoute } from "./endpoints/AuthPoint.js"; -import userRoutes, { userBasicRoute } from "./endpoints/UserPoint.js"; -import compactRecipeRoutes from "./endpoints/CompactRecipePoint.js"; -import recipeRoutes from "./endpoints/RecipePoint.js"; +import authRoutes, { authBasicRoute } from "./endpoints/AuthRestResource.js"; +import userRoutes, { userBasicRoute } from "./endpoints/UserRestResource.js"; +import compactRecipeRoutes from "./endpoints/CompactRecipeRestResource.js"; +import recipeRoutes from "./endpoints/RecipeRestResource.js"; dotenv.config(); diff --git a/src/middleware/authenticationMiddleware.ts b/src/middleware/authenticationMiddleware.ts index 26cf375..27715e8 100644 --- a/src/middleware/authenticationMiddleware.ts +++ b/src/middleware/authenticationMiddleware.ts @@ -1,7 +1,7 @@ import { NextFunction, Request, Response } from "express"; import jwt from "jsonwebtoken"; import dotenv from "dotenv"; -import { authBasicRoute } from "../endpoints/AuthPoint.js"; +import { authBasicRoute } from "../endpoints/AuthRestResource.js"; import { AuthPayload } from "../dtos/AuthPayload.js"; import {HttpStatusCode} from "../apiHelpers/HttpStatusCodes.js"; @@ -47,8 +47,7 @@ export const authentication = ( } try { - const decoded = jwt.verify(token, JWT_SECRET) as AuthPayload; - req.currentUser = decoded; + req.currentUser = jwt.verify(token, JWT_SECRET) as AuthPayload; next(); } catch { return res.status(HttpStatusCode.UNAUTHORIZED).json({ message: "Unauthorized" });