Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more info about favicon.ico. #897

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/getting-started/folder-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -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](xcode.md#custom-working-directory) for more information.

To see the `favicon.ico` in action prepare a route in `/Sources/App/routes.swift` like this:

```swift
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I agree that the current docs are pretty unhelpful. I think it might be better to change the existing favicon.ico example to be a different type of file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The favicon.ico icon is always added at some point in a process of building a full-feature website. It think it should stay.

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.
Expand Down