一般来说,我对 Vapor 和后端逻辑非常陌生。\n我正在使用 Leaf 构建一个简单的 Web 应用程序,我正在尝试从 psql 数据库读取数据并将其显示在 html/css (leaf) 中页。\n问题是,当我将参数传递到页面时,它不会加载 css 和图像。
\n\n这是我的控制器中的功能
\n\nmy project configuration:\n\nApp\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Package.swift\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Resources\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Views\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.leaf\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Public\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 images (images resources)\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 styles (css resources)\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Sources\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 App\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Controllers\n \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 PoesiaController.swift\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Models\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Poesia.swift\n\nfinal class PoesiaController {\n\nfunc createView(_ req: Request) throws -> Future<View> {\n let id: Int = try req.parameters.next(Int.self)\n return Poesia.find(id, on: req).unwrap(or: NSError(domain: "errore", code: 1, userInfo: nil)).flatMap(to: View.self) { p in\n return try …Run Code Online (Sandbox Code Playgroud)