diff --git a/auth.js b/auth.js new file mode 100644 index 0000000..3be909f --- /dev/null +++ b/auth.js @@ -0,0 +1,7 @@ +export class Auth { + async redirect(event) { + event.respondWith(new Response( + 'extract query and redirect', {status: 200} + )) + } +} \ No newline at end of file diff --git a/server.js b/server.js index 893336e..6cb3027 100644 --- a/server.js +++ b/server.js @@ -1,4 +1,10 @@ -class Server { +import { Auth } from './auth' + +export class Server { + constructor() { + this.auth = new Auth() + } + async getEnv(variables) { return Object.fromEntries( await Promise.all( @@ -27,18 +33,15 @@ class Server { async serveRequest(event) { const {pathname} = new URL(event.request.url) if (pathname === `${this.baseUrl}/api/auth`) { - event.respondWith(new Response( - 'extract query and redirect', {status: 200} - )) + await this.auth.redirect(event) } else { event.respondWith(new Response( - 'here', {status: 404} + 'Not Found', {status: 404} )) } } async serveConn(conn) { - console.log({conn}) const httpConn = Deno.serveHttp(conn) for await (const event of httpConn) { this.serveRequest(event)