mirror of https://github.com/vapor/docs.git
commit
928f13fbc0
|
|
@ -1,6 +1,6 @@
|
|||
# Getting Started with Async
|
||||
|
||||
The Async module is provided as a part of Vapor Core ([vapor/core](https://github.com/vapor/core)). It is a collection of convenience APIs (mostly extensions) built on top of [Swift NIO](https://github.com/apple/swift-nio).
|
||||
The Async module is provided as a part of Vapor Core ([vapor/core](https://github.com/vapor/core)). It is a collection of convenience APIs (mostly extensions) built on top of [SwiftNIO](https://github.com/apple/swift-nio).
|
||||
|
||||
!!! tip
|
||||
You can read more about SwiftNIO's async types (`Future`, `Promise`, `EventLoop`, and more) in its GitHub [README](https://github.com/apple/swift-nio/blob/master/README.md) or its [API Docs](https://apple.github.io/swift-nio/docs/current/NIO/index.html).
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
You may have noticed some APIs in Vapor expect or return a generic `Future` type. If this is your first time hearing about futures, they might seem a little confusing at first. But don't worry, Vapor makes them easy to use.
|
||||
|
||||
Promises and futures are related, but distinct types. Promises are used to _create_ futures. Most of the time, you will be working with futures returned by Vapor's APIs and you will not need to worry about creating promises.
|
||||
Promises and futures are related, but distinct, types. Promises are used to _create_ futures. Most of the time, you will be working with futures returned by Vapor's APIs and you will not need to worry about creating promises.
|
||||
|
||||
|type |description |mutability|methods |
|
||||
|---------|-----------------------------------------------------|----------|----------------------------------------------------|
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Getting Started with HTTP
|
||||
|
||||
HTTP ([vapor/http](https://github.com/vapor/http)) is a non-blocking, event-driven HTTP library built on Swift NIO. It makes working with Swift NIO's HTTP handlers easy and offers higher level functionality like media types, client upgrading, streaming bodies, and more. Creating an HTTP echo server takes just a few lines of code.
|
||||
HTTP ([vapor/http](https://github.com/vapor/http)) is a non-blocking, event-driven HTTP library built on SwiftNIO. It makes working with SwiftNIO's HTTP handlers easy and offers higher-level functionality like media types, client upgrading, streaming bodies, and more. Creating an HTTP echo server takes just a few lines of code.
|
||||
|
||||
!!! tip
|
||||
If you use Vapor, most of HTTP's APIs will be wrapped by more convenient methods. Usually the only HTTP type you
|
||||
|
|
@ -16,7 +16,7 @@ import Vapor
|
|||
|
||||
## Standalone
|
||||
|
||||
The HTTP package is lightweight, pure-Swift, and only depends in Swift NIO. This means it can be used as an HTTP framework any Swift project—even one not using Vapor.
|
||||
The HTTP package is lightweight, pure Swift, and only depends on SwiftNIO. This means it can be used as an HTTP framework in any Swift project—even one not using Vapor.
|
||||
|
||||
To include it in your package, add the following to your `Package.swift` file.
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ let server = try HTTPServer.start(
|
|||
try server.onClose.wait()
|
||||
```
|
||||
|
||||
The static [`start(...)`](https://api.vapor.codes/http/latest/HTTP/Classes/HTTPServer.html#/s:4HTTP10HTTPServerC5startXeXeFZ) method creates and returns a new [`HTTPServer`](https://api.vapor.codes/http/latest/HTTP/Classes/HTTPServer.html) asynchronously. The future will be completed when the server has finished boot succesfully, or it will contain an error if something went wrong.
|
||||
The static [`start(...)`](https://api.vapor.codes/http/latest/HTTP/Classes/HTTPServer.html#/s:4HTTP10HTTPServerC5startXeXeFZ) method creates and returns a new [`HTTPServer`](https://api.vapor.codes/http/latest/HTTP/Classes/HTTPServer.html) asynchronously. The future will be completed when the server has finished booting succesfully, or it will contain an error if something went wrong.
|
||||
|
||||
Once the start future is complete, our server is running. By waiting for the server's `onClose` future to complete, we can keep our application alive until the server closes. Normally the server will not close itself--it will just run indefinitely. However if `server.close()` is ever called, the application can exit gracefully.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# MySQL Core
|
||||
|
||||
MySQL ([vapor/mysql](https://github.com/vapor/mysql)) is a pure-Swift (no `libmysql` dependency), event-driven, non-blocking driver for MySQL. It's built on top of the [Swift NIO](http://github.com/apple/swift-nio) networking library.
|
||||
MySQL ([vapor/mysql](https://github.com/vapor/mysql)) is a pure-Swift (no `libmysql` dependency), event-driven, non-blocking driver for MySQL. It's built on top of the [SwiftNIO](http://github.com/apple/swift-nio) networking library.
|
||||
|
||||
!!! seealso
|
||||
The higher-level, Fluent MySQL ORM guide is located at [MySQL → Fluent](fluent.md)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# PostgreSQL Core
|
||||
|
||||
PostgreSQL ([vapor/postgresql](https://github.com/vapor/postgresql)) is a pure-Swift (no `libpq` dependency), event-driven, non-blocking driver for PostgreSQL. It's built on top of the [Swift NIO](http://github.com/apple/swift-nio) networking library.
|
||||
PostgreSQL ([vapor/postgresql](https://github.com/vapor/postgresql)) is a pure-Swift (no `libpq` dependency), event-driven, non-blocking driver for PostgreSQL. It's built on top of the [SwiftNIO](http://github.com/apple/swift-nio) networking library.
|
||||
|
||||
!!! seealso
|
||||
The higher-level, Fluent PostgreSQL ORM guide is located at [PostgreSQL → Fluent](fluent.md)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Getting Started with WebSocket
|
||||
|
||||
WebSocket ([vapor/websocket](https://github.com/vapor/websocket)) is a non-blocking, event-driven WebSocket library built on Swift NIO. It makes working with Swift NIO's WebSocket handlers easy and provides integration with [HTTP](../http/getting-started) clients and servers. Creating a WebSocket echo server takes just a few lines of code.
|
||||
WebSocket ([vapor/websocket](https://github.com/vapor/websocket)) is a non-blocking, event-driven WebSocket library built on SwiftNIO. It makes working with SwiftNIO's WebSocket handlers easy and provides integration with [HTTP](../http/getting-started) clients and servers. Creating a WebSocket echo server takes just a few lines of code.
|
||||
|
||||
!!! tip
|
||||
If you use Vapor, most of WebSocket's APIs will be wrapped by more convenient methods.
|
||||
|
|
@ -15,7 +15,7 @@ import Vapor
|
|||
|
||||
## Standalone
|
||||
|
||||
The WebSocket package is lightweight, pure-Swift, and only depends in Swift NIO. This means it can be used as a WebSocket framework any Swift project—even one not using Vapor.
|
||||
The WebSocket package is lightweight, pure Swift, and only depends on SwiftNIO. This means it can be used as a WebSocket framework any Swift project—even one not using Vapor.
|
||||
|
||||
To include it in your package, add the following to your `Package.swift` file.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue