Avatar
omochimetaru 4/3/2024 3:18 PM
おーー
3:18 PM
Vapor.Application が消えて、生の channel が生えてる。 (edited)
3:19 PM
はいはいはい
3:20 PM
直nioいいね
3:22 PM
channelReadでHTTPRequest受け取るのこんな感じになるのかー
3:22 PM
NIOHTTP1モジュールでほんとに最低限はいけるんだね
3:23 PM
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