feat(api): initial implementation of the auth system (#30)

Adds the auth system but does not add all required features. They will be handled in other tickets
This commit is contained in:
sct
2020-08-28 09:34:15 +09:00
committed by GitHub
parent 7ac4bb01f0
commit 5343f35e5b
10 changed files with 315 additions and 6 deletions

21
server/types/express.d.ts vendored Normal file
View File

@@ -0,0 +1,21 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import type { NextFunction, Request, Response } from 'express';
import type { User } from '../entity/User';
declare global {
namespace Express {
export interface Session {
userId?: number;
}
export interface Request {
user?: User;
}
}
}
export type Middleware = <ParamsDictionary, any, any>(
req: Request,
res: Response,
next: NextFunction
) => Promise<void | NextFunction> | void | NextFunction;