feat: new user resource integrating postgresql

This commit is contained in:
Daniel Ledda
2022-07-08 09:31:34 +02:00
parent 3e5c53f9f5
commit ba68f953f0
18 changed files with 281 additions and 121 deletions

View File

@@ -1,7 +1,22 @@
export type HttpMethod = "POST" | "GET" | "PUT" | "DELETE";
export default interface StoccaTreRequest {
method: HttpMethod,
route: string,
body: string | null,
export type RouteDefinition = {
pattern: RegExp;
method: HttpMethod;
};
export default class StoccaTreRequest {
constructor(
public method: HttpMethod,
public route: string,
public body: string | null,
) {}
match(route: RouteDefinition): RegExpExecArray | null {
const patternResult = route.pattern.exec(this.route);
if (route.method !== this.method) {
return null;
}
return patternResult;
}
}