Files
blog-service/backend/src/middleware/auth.ts
T

22 lines
441 B
TypeScript
Raw Normal View History

2026-05-23 18:03:46 -05:00
import { Request, Response, NextFunction } from "express";
import { users } from "../db/schema.ts";
export async function auth(
req: Request,
res: Response,
next: NextFunction
) {
// Either get the user profile of the logged in user,
// or default to anonymous permissions
const token = req.header("Authentication");
if (!token) {
return res.status(401).json({
error: "Missing Token",
});
};
next();
};