add frontend class for serving frontend files from repos

shared-server
bat 3 years ago
parent dcaf72e700
commit b43f35d1b9

@ -0,0 +1,8 @@
export class Frontend {
async serve(event) {
// TODO: load files from different mounted repos
event.respondWith(new Response(
'Not Found', {status: 404}
))
}
}

@ -1,8 +1,10 @@
import { Auth } from './auth' import { Auth } from "./auth"
import { Frontend } from "./frontend"
export class Server { export class Server {
constructor() { constructor() {
this.auth = new Auth() this.auth = new Auth()
this.frontend = new Frontend()
} }
async getEnv(variables) { async getEnv(variables) {
@ -35,9 +37,7 @@ export class Server {
if (pathname === `${this.baseUrl}/api/auth`) { if (pathname === `${this.baseUrl}/api/auth`) {
await this.auth.redirect(event) await this.auth.redirect(event)
} else { } else {
event.respondWith(new Response( await this.frontend.serve(event)
'Not Found', {status: 404}
))
} }
} }

Loading…
Cancel
Save