Compare commits

...

5 Commits

Author SHA1 Message Date
Łukasz Wieczorek 9bc0284fc3
Merge 5892ce34a1 into 12b0114882 2025-05-24 13:11:44 +02:00
Gwynne Raskind 12b0114882
.time is not actually supported, stop claiming it is (#1078)
Pretty much what it says on the tin. Since the only change is a
deletion, no separate translation is needed.
2025-05-05 09:51:07 -05:00
Łukasz Wieczorek 5892ce34a1 Move favicon sample to middleware docs. 2023-09-05 12:17:12 +02:00
Łukasz Wieczorek 02e694e0e3 Fix Markdown document path. 2023-09-04 18:58:54 +02:00
Łukasz Wieczorek 08bfaef4f1 Add more info about favicon.ico. 2023-09-04 16:48:40 +02:00
6 changed files with 32 additions and 5 deletions

View File

@ -132,6 +132,33 @@ let file = try FileMiddleware(bundle: .main, publicDirectory: "Public")
Also make sure to use Folder References instead of Groups in Xcode to maintain folder structure in resources after building the application.
The following code from `/Sources/App/routes.swift` can be used with a `favicon.ico` put in `Public/`. The icon of your choosing should be visible on your tab in a browser if you visit the server root resource.
```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>
"""
)
}
}
```
## CORS Middleware
Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served. REST APIs built in Vapor will require a CORS policy in order to safely return requests to modern web browsers.

View File

@ -74,7 +74,6 @@ Debajo hay un listado con los tipos de datos soportados.
|`.uint{8,16,32,64}`|`UInt{8,16,32,64}`|
|`.bool`|`Bool`|
|`.datetime`|`Date` (recomendado)|
|`.time`|`Date` (omitiendo día, mes y año)|
|`.date`|`Date` (omitiendo hora y minutos del día)|
|`.float`|`Float`|
|`.double`|`Double`|

View File

@ -74,7 +74,6 @@ Supported field data types are listed below.
|`.uint{8,16,32,64}`|`UInt{8,16,32,64}`|
|`.bool`|`Bool`|
|`.datetime`|`Date` (recommended)|
|`.time`|`Date` (omitting day, month, and year)|
|`.date`|`Date` (omitting time of day)|
|`.float`|`Float`|
|`.double`|`Double`|

View File

@ -74,7 +74,6 @@ Ondersteunde velddatatypes staan hieronder vermeld.
|`.uint{8,16,32,64}`|`UInt{8,16,32,64}`|
|`.bool`|`Bool`|
|`.datetime`|`Date` (aanbevolen)|
|`.time`|`Date` (zonder dag, maand en jaar)|
|`.date`|`Date` (het tijdstip weglaten)|
|`.float`|`Float`|
|`.double`|`Double`|

View File

@ -74,7 +74,6 @@ database.schema("planets").delete()
|`.uint{8,16,32,64}`|`UInt{8,16,32,64}`|
|`.bool`|`Bool`|
|`.datetime`|`Date` (recommended)|
|`.time`|`Date` (omitting day, month, and year)|
|`.date`|`Date` (omitting time of day)|
|`.float`|`Float`|
|`.double`|`Double`|
@ -404,4 +403,4 @@ try await db.schema("planets", space: "mirror_universe")
.id()
// ...
.create()
```
```

View File

@ -35,6 +35,10 @@ 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.
## Sources
This folder contains all of the Swift source files for your project.