Skip to content

Commit

Permalink
Do not use new for router
Browse files Browse the repository at this point in the history
  • Loading branch information
FinlayDaG33k committed Jul 31, 2023
1 parent 00b71d4 commit 8d45f99
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions webserver/webserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { StatusCodes } from "./http/status-codes.ts";

export class Webserver {
private server: any = null;
private router: Router = new Router();

constructor(
private readonly port: number = 80
Expand All @@ -31,7 +30,7 @@ export class Webserver {
Logger.debug(`Request from "${(conn.remoteAddr as Deno.NetAddr).hostname!}:${(conn.remoteAddr as Deno.NetAddr).port!}": ${request.request.method} | ${request.request.url}`);
try {
// Run the required route
const response: Response = await this.router.execute(request.request);
const response: Response = await Router.execute(request.request);

// Send our response
await request.respondWith(response);
Expand Down

0 comments on commit 8d45f99

Please sign in to comment.