Skip to content

Commit 1db77dd

Browse files
authored
Update README.md (apple#731)
1 parent ade82ab commit 1db77dd

8 files changed

+12
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct Handler: APIProtocol {
6666

6767
@main struct HelloWorldVaporServer {
6868
static func main() async throws {
69-
let app = Vapor.Application()
69+
let app = try await Application.make()
7070
let transport = VaporTransport(routesBuilder: app)
7171
let handler = Handler()
7272
try handler.registerHandlers(on: transport, serverURL: URL(string: "/api")!)

Sources/swift-openapi-generator/Documentation.docc/Articles/Practicing-spec-driven-API-development.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ This example starts with a [Vapor](https://github.com/vapor/vapor) server that h
138138
The existing server might look something like this:
139139

140140
```swift
141-
let app = Vapor.Application()
141+
let app = try await Vapor.Application.make()
142142
app.get("foo") { ... a, b, c ... }
143143
app.post("foo") { ... a, b, c ... }
144144
app.get("bar") { ... a, b, c ... }
@@ -173,7 +173,7 @@ As you go through the tutorial, the important part is that you only _add_ the ge
173173
After this step, your code looks something like this:
174174

175175
```swift
176-
let app = Vapor.Application()
176+
let app = try await Vapor.Application.make()
177177
178178
// Registers your existing routes.
179179
app.get("foo") { ... a, b, c ... }
@@ -216,7 +216,7 @@ paths:
216216
Comment out the first of the existing route implementations in your Vapor app:
217217

218218
```swift
219-
let app = Vapor.Application()
219+
let app = try await Vapor.Application.make()
220220
221221
// Registers your existing routes.
222222
// app.get("foo") { ... a, b, c ... } // <<< just comment this out, and this route will be registered below by registerHandlers, as it is now defined by your OpenAPI document.
@@ -236,7 +236,7 @@ When you compile the example above, you'll get a build error because `APIProtoco
236236
Xcode will offer a Fix-it, and if you accept it, it will drop in a function stub that you can fill in:
237237

238238
```swift
239-
let app = Vapor.Application()
239+
let app = try await Vapor.Application.make()
240240
241241
// Registers your existing routes.
242242
// <<< now you can just delete the first original route, as you've moved the business logic below into the Handler type
@@ -271,7 +271,7 @@ Endpoints that provide static content, such as CSS or JavaScript files, are not
271271
The end result should look something like this:
272272

273273
```swift
274-
let app = Vapor.Application()
274+
let app = try await Vapor.Application.make()
275275
276276
// Register some manual routes, for example, for serving static files.
277277
app.middlewares.on(FileMiddleware(...))

Sources/swift-openapi-generator/Documentation.docc/Swift-OpenAPI-Generator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct Handler: APIProtocol {
6565

6666
@main struct HelloWorldVaporServer {
6767
static func main() async throws {
68-
let app = Vapor.Application()
68+
let app = try await Application.make()
6969
let transport = VaporTransport(routesBuilder: app)
7070
let handler = Handler()
7171
try handler.registerHandlers(on: transport, serverURL: URL(string: "/api")!)

Sources/swift-openapi-generator/Documentation.docc/Tutorials/_Resources/server-openapi-endpoints.main.0.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct GreetingServiceAPIImpl: APIProtocol {
1515
}
1616

1717
// Create your Vapor application.
18-
let app = Vapor.Application()
18+
let app = try await Vapor.Application.make()
1919

2020
// Create a VaporTransport using your application.
2121
let transport = VaporTransport(routesBuilder: app)

Sources/swift-openapi-generator/Documentation.docc/Tutorials/_Resources/server-openapi-endpoints.main.1.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct GreetingServiceAPIImpl: APIProtocol {
1515
}
1616

1717
// Create your Vapor application.
18-
let app = Vapor.Application()
18+
let app = try await Vapor.Application.make()
1919

2020
// Create a VaporTransport using your application.
2121
let transport = VaporTransport(routesBuilder: app)

Sources/swift-openapi-generator/Documentation.docc/Tutorials/_Resources/server-openapi-endpoints.main.2.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct GreetingServiceAPIImpl: APIProtocol {
1515
}
1616

1717
// Create your Vapor application.
18-
let app = Vapor.Application()
18+
let app = try await Vapor.Application.make()
1919

2020
// Create a VaporTransport using your application.
2121
let transport = VaporTransport(routesBuilder: app)

Sources/swift-openapi-generator/Documentation.docc/Tutorials/_Resources/server.main.1.2.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct GreetingServiceAPIImpl: APIProtocol {
1515
}
1616

1717
// Create your Vapor application.
18-
let app = Vapor.Application()
18+
let app = try await Vapor.Application.make()
1919

2020
// Create a VaporTransport using your application.
2121
let transport = VaporTransport(routesBuilder: app)

Sources/swift-openapi-generator/Documentation.docc/Tutorials/_Resources/server.main.2.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct GreetingServiceAPIImpl: APIProtocol {
2323
}
2424

2525
// Create your Vapor application.
26-
let app = Vapor.Application()
26+
let app = try await Vapor.Application.make()
2727

2828
// Create a VaporTransport using your application.
2929
let transport = VaporTransport(routesBuilder: app)

0 commit comments

Comments
 (0)