Skip to content

Update README.md #731

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

Merged
merged 3 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct Handler: APIProtocol {

@main struct HelloWorldVaporServer {
static func main() async throws {
let app = Vapor.Application()
let app = try await Application.make()
let transport = VaporTransport(routesBuilder: app)
let handler = Handler()
try handler.registerHandlers(on: transport, serverURL: URL(string: "/api")!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ This example starts with a [Vapor](https://github.com/vapor/vapor) server that h
The existing server might look something like this:

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

```swift
let app = Vapor.Application()
let app = try await Vapor.Application.make()

// Registers your existing routes.
app.get("foo") { ... a, b, c ... }
Expand Down Expand Up @@ -216,7 +216,7 @@ paths:
Comment out the first of the existing route implementations in your Vapor app:

```swift
let app = Vapor.Application()
let app = try await Vapor.Application.make()

// Registers your existing routes.
// 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.
Expand All @@ -236,7 +236,7 @@ When you compile the example above, you'll get a build error because `APIProtoco
Xcode will offer a Fix-it, and if you accept it, it will drop in a function stub that you can fill in:

```swift
let app = Vapor.Application()
let app = try await Vapor.Application.make()

// Registers your existing routes.
// <<< now you can just delete the first original route, as you've moved the business logic below into the Handler type
Expand Down Expand Up @@ -271,7 +271,7 @@ Endpoints that provide static content, such as CSS or JavaScript files, are not
The end result should look something like this:

```swift
let app = Vapor.Application()
let app = try await Vapor.Application.make()

// Register some manual routes, for example, for serving static files.
app.middlewares.on(FileMiddleware(...))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct Handler: APIProtocol {

@main struct HelloWorldVaporServer {
static func main() async throws {
let app = Vapor.Application()
let app = try await Application.make()
let transport = VaporTransport(routesBuilder: app)
let handler = Handler()
try handler.registerHandlers(on: transport, serverURL: URL(string: "/api")!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct GreetingServiceAPIImpl: APIProtocol {
}

// Create your Vapor application.
let app = Vapor.Application()
let app = try await Vapor.Application.make()

// Create a VaporTransport using your application.
let transport = VaporTransport(routesBuilder: app)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct GreetingServiceAPIImpl: APIProtocol {
}

// Create your Vapor application.
let app = Vapor.Application()
let app = try await Vapor.Application.make()

// Create a VaporTransport using your application.
let transport = VaporTransport(routesBuilder: app)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct GreetingServiceAPIImpl: APIProtocol {
}

// Create your Vapor application.
let app = Vapor.Application()
let app = try await Vapor.Application.make()

// Create a VaporTransport using your application.
let transport = VaporTransport(routesBuilder: app)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct GreetingServiceAPIImpl: APIProtocol {
}

// Create your Vapor application.
let app = Vapor.Application()
let app = try await Vapor.Application.make()

// Create a VaporTransport using your application.
let transport = VaporTransport(routesBuilder: app)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct GreetingServiceAPIImpl: APIProtocol {
}

// Create your Vapor application.
let app = Vapor.Application()
let app = try await Vapor.Application.make()

// Create a VaporTransport using your application.
let transport = VaporTransport(routesBuilder: app)
Expand Down
Loading