update cn doc (#789)

This commit is contained in:
JIN 2023-04-12 21:13:47 +08:00 committed by GitHub
parent ee90248d5f
commit 9e261b452c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -125,6 +125,14 @@ app.middleware.use(file)
一旦注册 `FileMiddleware`,比如 `Public/images/logo.png` 的文件可以在 Leaf 模板通过 `<img src="/images/logo.png"/>` 方式引用。
如果你的服务器包含在一个 Xcode 项目中,比如一个 iOS 应用,可以使用以下代码代替:
```swift
let file = try FileMiddleware(bundle: .main, publicDirectory: "Public")
```
同时,请确保在 Xcode 中使用文件夹引用Folder References而不是 Xcode 中的组Groups来保持资源文件夹结构在构建应用程序后不变。
## CORS Middleware