let response: StaticResponse do { switch head.uri { case "/": response = try respondIndexPage(context: context) case "/main.wasm": response = StaticResponse( contentType: "application/wasm", body: try context.channel.allocator.buffer( bytes: localFileSystem.readFileContents(configuration.mainWasmPath).contents ) ) default: guard let staticResponse = try self.respond(context: context, head: head) else { self.respond404(context: context) return } response = staticResponse } } catch { configuration.logger.error("Failed to respond to \(head.uri): \(error)") response = StaticResponse( contentType: "text/plain", body: context.channel.allocator.buffer(string: "Internal server error") ) } self.responseBody = response.body
ルーティングw