Add more info about favicon.ico.

This commit is contained in:
Łukasz Wieczorek 2023-09-04 16:48:40 +02:00
parent a5a1d95b90
commit 08bfaef4f1
1 changed files with 29 additions and 0 deletions

View File

@ -35,6 +35,35 @@ let fileMiddleware = FileMiddleware(
app.middleware.use(fileMiddleware)
```
If running from Xcode please set the project schema run option working directory.
See [here](https://docs.vapor.codes/getting-started/xcode/#custom-working-directory) for more information.
To see the `favicon.ico` in action prepare a route in `/Sources/App/routes.swift` like this:
```swift
import Vapor
func routes(_ app: Application) throws {
app.get { req async in
Response(
status: .ok,
headers: ["Content-Type": "text/html"],
body:
"""
<html>
<head>
<link rel="shortcut icon" href="/favicon.ico">
</head>
<body>
It works!
</body>
</html>
"""
)
}
}
```
## Sources
This folder contains all of the Swift source files for your project.