feat: new user resource integrating postgresql
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user