From 33f94bbce3e5efae90665b9650e5c3628c6a3963 Mon Sep 17 00:00:00 2001 From: tanner0101 Date: Thu, 18 May 2017 15:21:28 +0100 Subject: [PATCH] build --- build/2.0/404.html | 16 +- build/2.0/advanced/modules/index.html | 18 +- build/2.0/auth/getting-started/index.html | 16 +- build/2.0/auth/helper/index.html | 16 +- build/2.0/auth/package/index.html | 16 +- build/2.0/auth/password/index.html | 16 +- build/2.0/auth/persist/index.html | 16 +- build/2.0/auth/provider/index.html | 16 +- build/2.0/bits/overview/index.html | 16 +- build/2.0/bits/package/index.html | 16 +- build/2.0/cache/overview/index.html | 16 +- build/2.0/cache/package/index.html | 16 +- build/2.0/core/overview/index.html | 16 +- build/2.0/core/package/index.html | 16 +- build/2.0/debugging/overview/index.html | 16 +- build/2.0/debugging/package/index.html | 16 +- build/2.0/fluent/database/index.html | 16 +- build/2.0/fluent/getting-started/index.html | 16 +- build/2.0/fluent/model/index.html | 16 +- build/2.0/fluent/package/index.html | 16 +- build/2.0/fluent/query/index.html | 16 +- build/2.0/fluent/relations/index.html | 16 +- .../getting-started/hello-world/index.html | 102 +- .../install-on-macos/index.html | 16 +- .../install-on-ubuntu/index.html | 16 +- build/2.0/getting-started/manual/index.html | 16 +- build/2.0/getting-started/toolbox/index.html | 16 +- build/2.0/getting-started/xcode/index.html | 16 +- build/2.0/http/body/index.html | 16 +- build/2.0/http/client/index.html | 16 +- build/2.0/http/cors/index.html | 16 +- build/2.0/http/middleware/index.html | 16 +- build/2.0/http/request/index.html | 16 +- build/2.0/http/responder/index.html | 16 +- .../http/response-representable/index.html | 16 +- build/2.0/http/response/index.html | 16 +- build/2.0/http/server/index.html | 16 +- build/2.0/index.html | 118 +- build/2.0/json/overview/index.html | 16 +- build/2.0/json/package/index.html | 16 +- build/2.0/leaf/leaf/index.html | 16 +- build/2.0/leaf/package/index.html | 16 +- build/2.0/leaf/provider/index.html | 16 +- build/2.0/mkdocs/search_index.json | 93 +- build/2.0/mysql/driver/index.html | 16 +- build/2.0/mysql/package/index.html | 16 +- build/2.0/mysql/provider/index.html | 16 +- build/2.0/node/package/index.html | 16 +- build/2.0/redis/package/index.html | 16 +- build/2.0/redis/provider/index.html | 16 +- build/2.0/routing/collection/index.html | 16 +- build/2.0/routing/group/index.html | 16 +- build/2.0/routing/overview/index.html | 16 +- build/2.0/routing/package/index.html | 16 +- build/2.0/routing/parameters/index.html | 16 +- build/2.0/sessions/sessions/index.html | 16 +- build/2.0/settings/config/index.html | 16 +- build/2.0/sitemap.xml | 10 +- build/2.0/validation/overview/index.html | 16 +- build/2.0/vapor/commands/index.html | 16 +- build/2.0/vapor/controllers/index.html | 16 +- build/2.0/vapor/droplet/index.html | 18 +- build/2.0/vapor/folder-structure/index.html | 16 +- build/2.0/vapor/hash/index.html | 16 +- build/2.0/vapor/log/index.html | 16 +- build/2.0/vapor/provider/index.html | 16 +- build/2.0/vapor/views/index.html | 16 +- build/2.0/{switch => version}/1_5/index.html | 14 +- build/2.0/{switch => version}/2_0/index.html | 28 +- build/2.0/version/support/index.html | 1685 +++++++++++++++++ 70 files changed, 2814 insertions(+), 248 deletions(-) rename build/2.0/{switch => version}/1_5/index.html (99%) rename build/2.0/{switch => version}/2_0/index.html (97%) create mode 100644 build/2.0/version/support/index.html diff --git a/build/2.0/404.html b/build/2.0/404.html index 4c8f5f3f..82c52b6b 100644 --- a/build/2.0/404.html +++ b/build/2.0/404.html @@ -1397,7 +1397,7 @@
  • - + 1.5
  • @@ -1409,12 +1409,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/advanced/modules/index.html b/build/2.0/advanced/modules/index.html index 582d2cf8..a2e781f1 100644 --- a/build/2.0/advanced/modules/index.html +++ b/build/2.0/advanced/modules/index.html @@ -1412,7 +1412,7 @@
  • - + 1.5
  • @@ -1424,12 +1424,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + @@ -1494,7 +1506,7 @@ - -
    -

    Warning

    -

    Use vapor new Hello --template=api --branch=beta while Vapor 2 is in beta

    -

    Vapor's folder structure will probably look familiar to you if you have worked with other web frameworks.

    Hello
    -├── Sources
    -│   └── App
    -│       └── Controllers
    -│       └── Middleware
    -│       └── Models
    -│       └── main.swift
    +├── Config
    +│   ├── app.json
    +│   ├── crypto.json
    +│   ├── droplet.json
    +│   ├── fluent.json
    +│   └── server.json
    +├── Package.pins
    +├── Package.swift
     ├── Public
    -├── Resources
    -│   └── Views
    -└── Package.swift
    +├── README.md
    +├── Sources
    +│   ├── App
    +│   │   ├── Config+Setup.swift
    +│   │   ├── Controllers
    +│   │   │   └── PostController.swift
    +│   │   ├── Droplet+Setup.swift
    +│   │   ├── Models
    +│   │   │   └── Post.swift
    +│   │   └── Routes.swift
    +│   └── Run
    +│       └── main.swift
    +├── Tests
    +│   ├── AppTests
    +│   │   ├── PostControllerTests.swift
    +│   │   ├── RouteTests.swift
    +│   │   └── Utilities.swift
    +│   └── LinuxMain.swift
    +├── circle.yml
    +└── license
     
    -

    For our Hello, World project, we will be focusing on the main.swift file.

    +

    For our Hello, World project, we will be focusing on the Routes.swift file.

    Hello
     └── Sources
         └── App
    -        └── main.swift
    +        └── Routes.swift
     
    @@ -1737,34 +1750,27 @@

    Code

    Droplet

    -

    Look for the following line in the main.swift file.

    -
    let drop = try Droplet()
    +

    Look for the following line in the Routes.swift file.

    +
    func build(_ builder: RouteBuilder) throws
     
    -

    This is where the one and only Dropletfor this example will be created. The Droplet class has a plethora of useful functions on it, and is used extensively.

    +

    This method is where all the routes for our application will be added.

    Routing

    -

    Right after the creation of drop, add the following code snippet.

    -
    drop.get("hello") { request in
    +

    In the scope of the build method, look for the following statement.

    +
    builder.get("plaintext") { req in
         return "Hello, world!"
     }
     
    -

    This creates a new route on the Droplet that will match all GET requests to /hello.

    +

    This creates a new route that will match all GET requests to /plaintext.

    All route closures are passed an instance of Request that contains information such as the URI requested and data sent.

    This route simply returns a string, but anything that is ResponseRepresentable can be returned. Learn more in the Routing section of the guide.

    Tip

    Xcode autocomplete may add extraneous type information to your closure's input arguments. This can be deleted to keep the code clean. If you'd like to keep the type information add import HTTP to the top of the file.

    -

    Serving

    -

    At the bottom of the main file, make sure to run your Droplet.

    -
    drop.run()
    -
    - - -

    Save the file, and switch back to the terminal.

    Compile & Run

    Building

    A big part of what makes Vapor so great is Swift's state of the art compiler. Let's fire it up. Make sure you are in the root directory of the project and run the following command.

    @@ -1788,13 +1794,13 @@
    -

    Serving

    +

    Serving

    Boot up the server by running the following command.

    vapor run serve
     
    -

    You should see a message Server starting.... You can now visit http://localhost:8080/hello in your browser.

    +

    You should see a message Server starting.... You can now visit http://localhost:8080/plaintext in your browser.

    Note

    Certain port numbers require super user access to bind. Simply run sudo vapor run to allow access. If you decide to run on a port besides 80, make sure to direct your browser accordingly.

    diff --git a/build/2.0/getting-started/install-on-macos/index.html b/build/2.0/getting-started/install-on-macos/index.html index 3cd4690c..016a6e52 100644 --- a/build/2.0/getting-started/install-on-macos/index.html +++ b/build/2.0/getting-started/install-on-macos/index.html @@ -1507,7 +1507,7 @@
  • - + 1.5
  • @@ -1519,12 +1519,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/getting-started/install-on-ubuntu/index.html b/build/2.0/getting-started/install-on-ubuntu/index.html index 5dbe2d3d..d24cbad6 100644 --- a/build/2.0/getting-started/install-on-ubuntu/index.html +++ b/build/2.0/getting-started/install-on-ubuntu/index.html @@ -1487,7 +1487,7 @@
  • - + 1.5
  • @@ -1499,12 +1499,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/getting-started/manual/index.html b/build/2.0/getting-started/manual/index.html index c679e534..169746db 100644 --- a/build/2.0/getting-started/manual/index.html +++ b/build/2.0/getting-started/manual/index.html @@ -1493,7 +1493,7 @@
  • - + 1.5
  • @@ -1505,12 +1505,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/getting-started/toolbox/index.html b/build/2.0/getting-started/toolbox/index.html index 9e7cb85a..84627f1a 100644 --- a/build/2.0/getting-started/toolbox/index.html +++ b/build/2.0/getting-started/toolbox/index.html @@ -1486,7 +1486,7 @@
  • - + 1.5
  • @@ -1498,12 +1498,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/getting-started/xcode/index.html b/build/2.0/getting-started/xcode/index.html index e60e1280..b1e4b5a5 100644 --- a/build/2.0/getting-started/xcode/index.html +++ b/build/2.0/getting-started/xcode/index.html @@ -1459,7 +1459,7 @@
  • - + 1.5
  • @@ -1471,12 +1471,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/http/body/index.html b/build/2.0/http/body/index.html index dc057aed..5287240d 100644 --- a/build/2.0/http/body/index.html +++ b/build/2.0/http/body/index.html @@ -1486,7 +1486,7 @@
  • - + 1.5
  • @@ -1498,12 +1498,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/http/client/index.html b/build/2.0/http/client/index.html index af482c1d..9f2792b5 100644 --- a/build/2.0/http/client/index.html +++ b/build/2.0/http/client/index.html @@ -1535,7 +1535,7 @@
  • - + 1.5
  • @@ -1547,12 +1547,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/http/cors/index.html b/build/2.0/http/cors/index.html index e6c424a2..ad0c8af0 100644 --- a/build/2.0/http/cors/index.html +++ b/build/2.0/http/cors/index.html @@ -1466,7 +1466,7 @@
  • - + 1.5
  • @@ -1478,12 +1478,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/http/middleware/index.html b/build/2.0/http/middleware/index.html index 1ac3f469..c525db77 100644 --- a/build/2.0/http/middleware/index.html +++ b/build/2.0/http/middleware/index.html @@ -1534,7 +1534,7 @@
  • - + 1.5
  • @@ -1546,12 +1546,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/http/request/index.html b/build/2.0/http/request/index.html index 7566fd94..968aa7e2 100644 --- a/build/2.0/http/request/index.html +++ b/build/2.0/http/request/index.html @@ -1549,7 +1549,7 @@
  • - + 1.5
  • @@ -1561,12 +1561,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/http/responder/index.html b/build/2.0/http/responder/index.html index edad4d4a..561cd356 100644 --- a/build/2.0/http/responder/index.html +++ b/build/2.0/http/responder/index.html @@ -1460,7 +1460,7 @@
  • - + 1.5
  • @@ -1472,12 +1472,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/http/response-representable/index.html b/build/2.0/http/response-representable/index.html index 2870da76..1913cded 100644 --- a/build/2.0/http/response-representable/index.html +++ b/build/2.0/http/response-representable/index.html @@ -1460,7 +1460,7 @@
  • - + 1.5
  • @@ -1472,12 +1472,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/http/response/index.html b/build/2.0/http/response/index.html index dfc6ffe5..f13c27df 100644 --- a/build/2.0/http/response/index.html +++ b/build/2.0/http/response/index.html @@ -1514,7 +1514,7 @@
  • - + 1.5
  • @@ -1526,12 +1526,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/http/server/index.html b/build/2.0/http/server/index.html index 22c91e59..3673049f 100644 --- a/build/2.0/http/server/index.html +++ b/build/2.0/http/server/index.html @@ -1588,7 +1588,7 @@
  • - + 1.5
  • @@ -1600,12 +1600,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/index.html b/build/2.0/index.html index 3cba81a8..37e5c90d 100644 --- a/build/2.0/index.html +++ b/build/2.0/index.html @@ -285,6 +285,14 @@ Packages + +
  • @@ -1548,7 +1561,7 @@
  • - + 1.5
  • @@ -1560,12 +1573,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + @@ -1670,6 +1695,14 @@ Packages + +
  • @@ -1749,11 +1787,13 @@

    Packages

    Vapor is a modular framework built for a modular language. Code is split up into modules which are grouped to form packages. Packages can be added to your project by adding the package's Git url to your Package.swift file. Once a package is included, all of its modules will be available to import. You can read more about packages and modules in the Swift Package Manager conceptual overview.

    Below is a list of packages and modules that come with or can be used by Vapor projects. Packages will have a link to their respective GitHub page.

    -

    Included

    -

    Here is a list of all the packages and modules included with Vapor.

    +

    Core

    +

    Core packages are maintained by the Vapor team.

    +

    Included

    +

    The following packages are included with Vapor by default.

    Tip

    -

    While these packages are included in Vapor by default, they can also be used individually.

    +

    These packages can also be used individually

    • Vapor: Swift's most used web framework.
        @@ -1764,8 +1804,8 @@
    • Engine: Core transport layers.
        -
      • HTTP: Pure Swift HTTP client and server.
      • -
      • URI: Pure Swift URI parsing and serializing.
      • +
      • HTTP: HTTP client and server.
      • +
      • URI: URI parsing and serializing.
      • WebSockets: Full-duplex communication channels over a single TCP connection.
      • SMTP: Send email using Sendgrid and Gmail.
      @@ -1794,7 +1834,7 @@
    • Socks: Swift C Socket API wrapper.
    • Bits: Low level byte manipulation helpers
    -

    Extras

    +

    Providers

    These are officially supported packages for Vapor that are not included by default.

    • Fluent: Models, relationships, and querying for NoSQL and SQL databases.
        @@ -1819,8 +1859,8 @@
    -

    Third Party

    -

    These are packages created by community members that work great with Vapor.

    +

    Community

    +

    These are packages maintained by community members that work great with Vapor.

    • PostgreSQL: Robust PostgreSQL interface for Swift.
      • PostgreSQL Driver: PostgreSQL driver for Fluent.
      • @@ -1846,7 +1886,7 @@
      • Jobs: A minimalistic job/background-task system for Swift.
      • Heimdall: An easy to use HTTP request logger.
      -

      Providers

      +

      Providers

      Vapor providers are a convenient way to add functionality to your Vapor projects. For a full list of providers, check out the vapor-provider tag on GitHub.

      Authors

      Tanner Nelson, Logan Wright, and the hundreds of members of Vapor.

      diff --git a/build/2.0/json/overview/index.html b/build/2.0/json/overview/index.html index 4c345206..bdb3c342 100644 --- a/build/2.0/json/overview/index.html +++ b/build/2.0/json/overview/index.html @@ -1486,7 +1486,7 @@
    • - + 1.5
    • @@ -1498,12 +1498,24 @@
    • - + 2.0
    • + + + + + +
    • + + Support + +
    • + +
  • diff --git a/build/2.0/json/package/index.html b/build/2.0/json/package/index.html index 9f1a6a0c..deeb0907 100644 --- a/build/2.0/json/package/index.html +++ b/build/2.0/json/package/index.html @@ -1414,7 +1414,7 @@
  • - + 1.5
  • @@ -1426,12 +1426,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/leaf/leaf/index.html b/build/2.0/leaf/leaf/index.html index 8a1e3ae3..a6fe9b28 100644 --- a/build/2.0/leaf/leaf/index.html +++ b/build/2.0/leaf/leaf/index.html @@ -1611,7 +1611,7 @@
  • - + 1.5
  • @@ -1623,12 +1623,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/leaf/package/index.html b/build/2.0/leaf/package/index.html index 27d4e85a..80ed9649 100644 --- a/build/2.0/leaf/package/index.html +++ b/build/2.0/leaf/package/index.html @@ -1446,7 +1446,7 @@
  • - + 1.5
  • @@ -1458,12 +1458,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/leaf/provider/index.html b/build/2.0/leaf/provider/index.html index 29918a0c..6c7d55d3 100644 --- a/build/2.0/leaf/provider/index.html +++ b/build/2.0/leaf/provider/index.html @@ -1460,7 +1460,7 @@
  • - + 1.5
  • @@ -1472,12 +1472,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/mkdocs/search_index.json b/build/2.0/mkdocs/search_index.json index 7b8ca555..27f60821 100644 --- a/build/2.0/mkdocs/search_index.json +++ b/build/2.0/mkdocs/search_index.json @@ -2,7 +2,7 @@ "docs": [ { "location": "/", - "text": "Vapor Documentation\n\n\nThis is the documentation for Vapor, a Web Framework for Swift that works on iOS, macOS, and Ubuntu; and all of the packages that Vapor offers.\n\n\nVapor is the most used web framework for Swift. It provides a beautifully expressive and easy to use foundation for your next website or API.\n\n\nGetting Started\n\n\nIf this is your first time using Vapor, head to the \nGetting Started\n section to install Swift and create your first app.\n\n\nViewing Mediums\n\n\nYou can read this guide by clicking through the folders and markdown files on \nGitHub\n or through the rendered \nwebsite\n.\n\n\nOther Sources\n\n\nHere are some other great places to find information about Vapor.\n\n\nAPI\n\n\nAuto-generated API documentation is located at \napi.vapor.codes\n.\n\n\nStack Overflow\n\n\nView or ask questions related to Vapor on Stack Overflow using the \nvapor\n tag.\n\n\nGitHub\n\n\nSource Code\n\n\nTo view the framework's source code and code documentation, visit \nVapor's GitHub\n.\n\n\nIssues\n\n\nTo view open bug reports and feature requests, or to create one, visit the \nissues\n tab on \nVapor's GitHub\n.\n\n\nPackages\n\n\nVapor is a modular framework built for a modular language. Code is split up into modules which are grouped to form packages. Packages can be added to your project by adding the package's Git url to your \nPackage.swift\n file. Once a package is included, all of its modules will be available to \nimport\n. You can read more about packages and modules in the Swift Package Manager \nconceptual overview\n. \n\n\nBelow is a list of packages and modules that come with or can be used by Vapor projects. Packages will have a link to their respective GitHub page.\n\n\nIncluded\n\n\nHere is a list of all the packages and modules included with Vapor. \n\n\n\n\nTip\n\n\nWhile these packages are included in Vapor by default, they can also be used individually.\n\n\n\n\n\n\nVapor\n: Swift's most used web framework.\n\n\nAuth: User authentication and persistance.\n\n\nSessions: Secure, ephemeral cookie based data storage.\n\n\nCookies: HTTP cookies.\n\n\nRouting: Advanced router with type-safe parameterization.\n\n\n\n\n\n\nEngine\n: Core transport layers.\n\n\nHTTP: Pure Swift HTTP client and server.\n\n\nURI: Pure Swift URI parsing and serializing.\n\n\nWebSockets: Full-duplex communication channels over a single TCP connection.\n\n\nSMTP: Send email using Sendgrid and Gmail.\n\n\n\n\n\n\nMultipart\n: Fast, streaming, non-blocking multipart parser and serializer.\n\n\nMultipart: Parses and serializes \nmultipart/mixed\n.\n\n\nFormData: Parses and serializes \nmultipart/form-data\n.\n\n\n\n\n\n\nJSON\n: Conveniences for working with JSON in Swift.\n\n\nConsole\n: Swift wrapper for console IO and commands.\n\n\nTLS\n: Swift wrapper for CLibreSSL's new TLS.\n\n\nCrypto\n: Cryptography from LibreSSL and Swift.\n\n\nDigests: Hashing with and without authentication.\n\n\nCiphers: Encryption and decryption\n\n\nRandom: Pseudo and cryptographically secure randomness.\n\n\nBCrypt: Pure Swift implementation.\n\n\n\n\n\n\nNode\n: Data structure for easy type conversions.\n\n\nPolymorphic\n: Syntax for easily accessing values from common types like JSON.\n\n\nPath Indexable\n: A protocol for powerful subscript access of common types like JSON.\n\n\n\n\n\n\nCore\n: Core extensions, type-aliases, and functions that facilitate common tasks.\n\n\nSocks\n: Swift C Socket API wrapper.\n\n\nBits\n: Low level byte manipulation helpers\n\n\n\n\nExtras\n\n\nThese are officially supported packages for Vapor that are not included by default.\n\n\n\n\nFluent\n: Models, relationships, and querying for NoSQL and SQL databases.\n\n\nFluent Provider\n: Fluent provider for Vapor.\n\n\n\n\n\n\nMySQL\n: Robust MySQL interface for Swift.\n\n\nMySQL Driver\n: MySQL driver for Fluent.\n\n\nMySQL Provider\n: MySQL provider for Vapor.\n\n\n\n\n\n\nLeaf\n: An extensible templating language.\n\n\nLeaf Provider\n: Leaf provider for Vapor.\n\n\n\n\n\n\nRedbird\n: Pure-Swift Redis client implemented from the original protocol spec..\n\n\nRedis Provider\n: Redis cache provider for Vapor.\n\n\n\n\n\n\nJWT\n: JSON Web Tokens in Swift.\n\n\nJWT Provider\n: JWT conveniences for Vapor.\n\n\n\n\n\n\n\n\nThird Party\n\n\nThese are packages created by community members that work great with Vapor.\n\n\n\n\nPostgreSQL\n: Robust PostgreSQL interface for Swift.\n\n\nPostgreSQL Driver\n: PostgreSQL driver for Fluent.\n\n\nPostgreSQL Provider\n: PostgreSQL provider for Vapor.\n\n\n\n\n\n\nMongoKitten*\n: Native MongoDB driver for Swift, written in Swift\n\n\nMongo Driver\n: MongoKitten driver for Fluent.\n\n\nMongo Provider\n: MongoKitten provider for Vapor.\n\n\nMainecoonVapor\n: MongoKitten ORM for Vapor.\n\n\n\n\n\n\nKitura Provider\n: Use IBM's Kitura HTTP server in Vapor.\n\n\nSwiftyBeaver\n: Adds the powerful logging of SwiftyBeaver to Vapor.\n\n\nAPNS\n: Simple APNS Library for Vapor (Swift).\n\n\nVaporFCM\n: Simple FCM (iOS + Android Push Notifications) library built for Vapor in Swift.\n\n\nVaporS3Signer\n: Generate V4 Auth Header/Pre-Signed URL for AWS S3 REST API\n\n\nFlock\n: Automated deployment of Swift projects to servers\n\n\nVaporFlock\n: Use Flock to deploy Vapor applications\n\n\n\n\n\n\nVaporForms\n: Brings simple, dynamic and re-usable web form handling to Vapor.\n\n\nJobs\n: A minimalistic job/background-task system for Swift.\n\n\nHeimdall\n: An easy to use HTTP request logger.\n\n\n\n\nProviders\n\n\nVapor providers are a convenient way to add functionality to your Vapor projects. For a full list of providers, check out the \nvapor-provider\n tag on GitHub.\n\n\nAuthors\n\n\nTanner Nelson\n, \nLogan Wright\n, and the hundreds of members of Vapor.", + "text": "Vapor Documentation\n\n\nThis is the documentation for Vapor, a Web Framework for Swift that works on iOS, macOS, and Ubuntu; and all of the packages that Vapor offers.\n\n\nVapor is the most used web framework for Swift. It provides a beautifully expressive and easy to use foundation for your next website or API.\n\n\nGetting Started\n\n\nIf this is your first time using Vapor, head to the \nGetting Started\n section to install Swift and create your first app.\n\n\nViewing Mediums\n\n\nYou can read this guide by clicking through the folders and markdown files on \nGitHub\n or through the rendered \nwebsite\n.\n\n\nOther Sources\n\n\nHere are some other great places to find information about Vapor.\n\n\nAPI\n\n\nAuto-generated API documentation is located at \napi.vapor.codes\n.\n\n\nStack Overflow\n\n\nView or ask questions related to Vapor on Stack Overflow using the \nvapor\n tag.\n\n\nGitHub\n\n\nSource Code\n\n\nTo view the framework's source code and code documentation, visit \nVapor's GitHub\n.\n\n\nIssues\n\n\nTo view open bug reports and feature requests, or to create one, visit the \nissues\n tab on \nVapor's GitHub\n.\n\n\nPackages\n\n\nVapor is a modular framework built for a modular language. Code is split up into modules which are grouped to form packages. Packages can be added to your project by adding the package's Git url to your \nPackage.swift\n file. Once a package is included, all of its modules will be available to \nimport\n. You can read more about packages and modules in the Swift Package Manager \nconceptual overview\n. \n\n\nBelow is a list of packages and modules that come with or can be used by Vapor projects. Packages will have a link to their respective GitHub page.\n\n\nCore\n\n\nCore packages are maintained by the Vapor team. \n\n\nIncluded\n\n\nThe following packages are included with Vapor by default.\n\n\n\n\nTip\n\n\nThese packages can also be used individually\n\n\n\n\n\n\nVapor\n: Swift's most used web framework.\n\n\nAuth: User authentication and persistance.\n\n\nSessions: Secure, ephemeral cookie based data storage.\n\n\nCookies: HTTP cookies.\n\n\nRouting: Advanced router with type-safe parameterization.\n\n\n\n\n\n\nEngine\n: Core transport layers.\n\n\nHTTP: HTTP client and server.\n\n\nURI: URI parsing and serializing.\n\n\nWebSockets: Full-duplex communication channels over a single TCP connection.\n\n\nSMTP: Send email using Sendgrid and Gmail.\n\n\n\n\n\n\nMultipart\n: Fast, streaming, non-blocking multipart parser and serializer.\n\n\nMultipart: Parses and serializes \nmultipart/mixed\n.\n\n\nFormData: Parses and serializes \nmultipart/form-data\n.\n\n\n\n\n\n\nJSON\n: Conveniences for working with JSON in Swift.\n\n\nConsole\n: Swift wrapper for console IO and commands.\n\n\nTLS\n: Swift wrapper for CLibreSSL's new TLS.\n\n\nCrypto\n: Cryptography from LibreSSL and Swift.\n\n\nDigests: Hashing with and without authentication.\n\n\nCiphers: Encryption and decryption\n\n\nRandom: Pseudo and cryptographically secure randomness.\n\n\nBCrypt: Pure Swift implementation.\n\n\n\n\n\n\nNode\n: Data structure for easy type conversions.\n\n\nPolymorphic\n: Syntax for easily accessing values from common types like JSON.\n\n\nPath Indexable\n: A protocol for powerful subscript access of common types like JSON.\n\n\n\n\n\n\nCore\n: Core extensions, type-aliases, and functions that facilitate common tasks.\n\n\nSocks\n: Swift C Socket API wrapper.\n\n\nBits\n: Low level byte manipulation helpers\n\n\n\n\nProviders\n\n\nThese are officially supported packages for Vapor that are not included by default.\n\n\n\n\nFluent\n: Models, relationships, and querying for NoSQL and SQL databases.\n\n\nFluent Provider\n: Fluent provider for Vapor.\n\n\n\n\n\n\nMySQL\n: Robust MySQL interface for Swift.\n\n\nMySQL Driver\n: MySQL driver for Fluent.\n\n\nMySQL Provider\n: MySQL provider for Vapor.\n\n\n\n\n\n\nLeaf\n: An extensible templating language.\n\n\nLeaf Provider\n: Leaf provider for Vapor.\n\n\n\n\n\n\nRedbird\n: Pure-Swift Redis client implemented from the original protocol spec..\n\n\nRedis Provider\n: Redis cache provider for Vapor.\n\n\n\n\n\n\nJWT\n: JSON Web Tokens in Swift.\n\n\nJWT Provider\n: JWT conveniences for Vapor.\n\n\n\n\n\n\n\n\nCommunity\n\n\nThese are packages maintained by community members that work great with Vapor.\n\n\n\n\nPostgreSQL\n: Robust PostgreSQL interface for Swift.\n\n\nPostgreSQL Driver\n: PostgreSQL driver for Fluent.\n\n\nPostgreSQL Provider\n: PostgreSQL provider for Vapor.\n\n\n\n\n\n\nMongoKitten*\n: Native MongoDB driver for Swift, written in Swift\n\n\nMongo Driver\n: MongoKitten driver for Fluent.\n\n\nMongo Provider\n: MongoKitten provider for Vapor.\n\n\nMainecoonVapor\n: MongoKitten ORM for Vapor.\n\n\n\n\n\n\nKitura Provider\n: Use IBM's Kitura HTTP server in Vapor.\n\n\nSwiftyBeaver\n: Adds the powerful logging of SwiftyBeaver to Vapor.\n\n\nAPNS\n: Simple APNS Library for Vapor (Swift).\n\n\nVaporFCM\n: Simple FCM (iOS + Android Push Notifications) library built for Vapor in Swift.\n\n\nVaporS3Signer\n: Generate V4 Auth Header/Pre-Signed URL for AWS S3 REST API\n\n\nFlock\n: Automated deployment of Swift projects to servers\n\n\nVaporFlock\n: Use Flock to deploy Vapor applications\n\n\n\n\n\n\nVaporForms\n: Brings simple, dynamic and re-usable web form handling to Vapor.\n\n\nJobs\n: A minimalistic job/background-task system for Swift.\n\n\nHeimdall\n: An easy to use HTTP request logger.\n\n\n\n\nProviders\n\n\nVapor providers are a convenient way to add functionality to your Vapor projects. For a full list of providers, check out the \nvapor-provider\n tag on GitHub.\n\n\nAuthors\n\n\nTanner Nelson\n, \nLogan Wright\n, and the hundreds of members of Vapor.", "title": "Overview" }, { @@ -55,23 +55,28 @@ "text": "Vapor is a modular framework built for a modular language. Code is split up into modules which are grouped to form packages. Packages can be added to your project by adding the package's Git url to your Package.swift file. Once a package is included, all of its modules will be available to import . You can read more about packages and modules in the Swift Package Manager conceptual overview . Below is a list of packages and modules that come with or can be used by Vapor projects. Packages will have a link to their respective GitHub page.", "title": "Packages" }, + { + "location": "/#core", + "text": "Core packages are maintained by the Vapor team.", + "title": "Core" + }, { "location": "/#included", - "text": "Here is a list of all the packages and modules included with Vapor. Tip While these packages are included in Vapor by default, they can also be used individually. Vapor : Swift's most used web framework. Auth: User authentication and persistance. Sessions: Secure, ephemeral cookie based data storage. Cookies: HTTP cookies. Routing: Advanced router with type-safe parameterization. Engine : Core transport layers. HTTP: Pure Swift HTTP client and server. URI: Pure Swift URI parsing and serializing. WebSockets: Full-duplex communication channels over a single TCP connection. SMTP: Send email using Sendgrid and Gmail. Multipart : Fast, streaming, non-blocking multipart parser and serializer. Multipart: Parses and serializes multipart/mixed . FormData: Parses and serializes multipart/form-data . JSON : Conveniences for working with JSON in Swift. Console : Swift wrapper for console IO and commands. TLS : Swift wrapper for CLibreSSL's new TLS. Crypto : Cryptography from LibreSSL and Swift. Digests: Hashing with and without authentication. Ciphers: Encryption and decryption Random: Pseudo and cryptographically secure randomness. BCrypt: Pure Swift implementation. Node : Data structure for easy type conversions. Polymorphic : Syntax for easily accessing values from common types like JSON. Path Indexable : A protocol for powerful subscript access of common types like JSON. Core : Core extensions, type-aliases, and functions that facilitate common tasks. Socks : Swift C Socket API wrapper. Bits : Low level byte manipulation helpers", + "text": "The following packages are included with Vapor by default. Tip These packages can also be used individually Vapor : Swift's most used web framework. Auth: User authentication and persistance. Sessions: Secure, ephemeral cookie based data storage. Cookies: HTTP cookies. Routing: Advanced router with type-safe parameterization. Engine : Core transport layers. HTTP: HTTP client and server. URI: URI parsing and serializing. WebSockets: Full-duplex communication channels over a single TCP connection. SMTP: Send email using Sendgrid and Gmail. Multipart : Fast, streaming, non-blocking multipart parser and serializer. Multipart: Parses and serializes multipart/mixed . FormData: Parses and serializes multipart/form-data . JSON : Conveniences for working with JSON in Swift. Console : Swift wrapper for console IO and commands. TLS : Swift wrapper for CLibreSSL's new TLS. Crypto : Cryptography from LibreSSL and Swift. Digests: Hashing with and without authentication. Ciphers: Encryption and decryption Random: Pseudo and cryptographically secure randomness. BCrypt: Pure Swift implementation. Node : Data structure for easy type conversions. Polymorphic : Syntax for easily accessing values from common types like JSON. Path Indexable : A protocol for powerful subscript access of common types like JSON. Core : Core extensions, type-aliases, and functions that facilitate common tasks. Socks : Swift C Socket API wrapper. Bits : Low level byte manipulation helpers", "title": "Included" }, - { - "location": "/#extras", - "text": "These are officially supported packages for Vapor that are not included by default. Fluent : Models, relationships, and querying for NoSQL and SQL databases. Fluent Provider : Fluent provider for Vapor. MySQL : Robust MySQL interface for Swift. MySQL Driver : MySQL driver for Fluent. MySQL Provider : MySQL provider for Vapor. Leaf : An extensible templating language. Leaf Provider : Leaf provider for Vapor. Redbird : Pure-Swift Redis client implemented from the original protocol spec.. Redis Provider : Redis cache provider for Vapor. JWT : JSON Web Tokens in Swift. JWT Provider : JWT conveniences for Vapor.", - "title": "Extras" - }, - { - "location": "/#third-party", - "text": "These are packages created by community members that work great with Vapor. PostgreSQL : Robust PostgreSQL interface for Swift. PostgreSQL Driver : PostgreSQL driver for Fluent. PostgreSQL Provider : PostgreSQL provider for Vapor. MongoKitten* : Native MongoDB driver for Swift, written in Swift Mongo Driver : MongoKitten driver for Fluent. Mongo Provider : MongoKitten provider for Vapor. MainecoonVapor : MongoKitten ORM for Vapor. Kitura Provider : Use IBM's Kitura HTTP server in Vapor. SwiftyBeaver : Adds the powerful logging of SwiftyBeaver to Vapor. APNS : Simple APNS Library for Vapor (Swift). VaporFCM : Simple FCM (iOS + Android Push Notifications) library built for Vapor in Swift. VaporS3Signer : Generate V4 Auth Header/Pre-Signed URL for AWS S3 REST API Flock : Automated deployment of Swift projects to servers VaporFlock : Use Flock to deploy Vapor applications VaporForms : Brings simple, dynamic and re-usable web form handling to Vapor. Jobs : A minimalistic job/background-task system for Swift. Heimdall : An easy to use HTTP request logger.", - "title": "Third Party" - }, { "location": "/#providers", + "text": "These are officially supported packages for Vapor that are not included by default. Fluent : Models, relationships, and querying for NoSQL and SQL databases. Fluent Provider : Fluent provider for Vapor. MySQL : Robust MySQL interface for Swift. MySQL Driver : MySQL driver for Fluent. MySQL Provider : MySQL provider for Vapor. Leaf : An extensible templating language. Leaf Provider : Leaf provider for Vapor. Redbird : Pure-Swift Redis client implemented from the original protocol spec.. Redis Provider : Redis cache provider for Vapor. JWT : JSON Web Tokens in Swift. JWT Provider : JWT conveniences for Vapor.", + "title": "Providers" + }, + { + "location": "/#community", + "text": "These are packages maintained by community members that work great with Vapor. PostgreSQL : Robust PostgreSQL interface for Swift. PostgreSQL Driver : PostgreSQL driver for Fluent. PostgreSQL Provider : PostgreSQL provider for Vapor. MongoKitten* : Native MongoDB driver for Swift, written in Swift Mongo Driver : MongoKitten driver for Fluent. Mongo Provider : MongoKitten provider for Vapor. MainecoonVapor : MongoKitten ORM for Vapor. Kitura Provider : Use IBM's Kitura HTTP server in Vapor. SwiftyBeaver : Adds the powerful logging of SwiftyBeaver to Vapor. APNS : Simple APNS Library for Vapor (Swift). VaporFCM : Simple FCM (iOS + Android Push Notifications) library built for Vapor in Swift. VaporS3Signer : Generate V4 Auth Header/Pre-Signed URL for AWS S3 REST API Flock : Automated deployment of Swift projects to servers VaporFlock : Use Flock to deploy Vapor applications VaporForms : Brings simple, dynamic and re-usable web form handling to Vapor. Jobs : A minimalistic job/background-task system for Swift. Heimdall : An easy to use HTTP request logger.", + "title": "Community" + }, + { + "location": "/#providers_1", "text": "Vapor providers are a convenient way to add functionality to your Vapor projects. For a full list of providers, check out the vapor-provider tag on GitHub.", "title": "Providers" }, @@ -222,7 +227,7 @@ }, { "location": "/getting-started/hello-world/", - "text": "Hello, World\n\n\nThis section assumes you have installed Swift 3.1 and the Vapor Toolbox and have verified they are working.\n\n\n\n\nTip\n\n\nNote: If you don't want to use the Toolbox, follow the \nmanual guide\n.\n\n\n\n\nNew Project\n\n\nLet's start by creating a new project called \"Hello, World\".\n\n\nvapor new Hello --template\n=\napi\n\n\n\n\n\n\n\nWarning\n\n\nUse \nvapor new Hello --template=api --branch=beta\n while Vapor 2 is in beta\n\n\n\n\nVapor's folder structure will probably look familiar to you if you have worked with other web frameworks.\n\n\nHello\n\u251c\u2500\u2500 Sources\n\u2502 \u2514\u2500\u2500 App\n\u2502 \u2514\u2500\u2500 Controllers\n\u2502 \u2514\u2500\u2500 Middleware\n\u2502 \u2514\u2500\u2500 Models\n\u2502 \u2514\u2500\u2500 main.swift\n\u251c\u2500\u2500 Public\n\u251c\u2500\u2500 Resources\n\u2502 \u2514\u2500\u2500 Views\n\u2514\u2500\u2500 Package.swift\n\n\n\n\n\nFor our Hello, World project, we will be focusing on the \nmain.swift\n file.\n\n\nHello\n\u2514\u2500\u2500 Sources\n \u2514\u2500\u2500 App\n \u2514\u2500\u2500 main.swift\n\n\n\n\n\n\n\nTip\n\n\nThe \nvapor new\n command creates a new project with examples and comments about how to use the framework. You can delete these if you want.\n\n\n\n\nCode\n\n\nDroplet\n\n\nLook for the following line in the \nmain.swift\n file.\n\n\nlet\n \ndrop\n \n=\n \ntry\n \nDroplet\n()\n\n\n\n\n\n\nThis is where the one and only \nDroplet\nfor this example will be created. The \nDroplet\n class has a plethora of useful functions on it, and is used extensively.\n\n\nRouting\n\n\nRight after the creation of \ndrop\n, add the following code snippet.\n\n\ndrop\n.\nget\n(\nhello\n)\n \n{\n \nrequest\n \nin\n\n \nreturn\n \nHello, world!\n\n\n}\n\n\n\n\n\n\nThis creates a new route on the \nDroplet\n that will match all \nGET\n requests to \n/hello\n.\n\n\nAll route closures are passed an instance of \nRequest\n that contains information such as the URI requested and data sent.\n\n\nThis route simply returns a string, but anything that is \nResponseRepresentable\n can be returned. Learn more in the \nRouting\n section of the guide.\n\n\n\n\nTip\n\n\nXcode autocomplete may add extraneous type information to your closure's input arguments. This can be deleted to keep the code clean. If you'd like to keep the type information add \nimport HTTP\n to the top of the file.\n\n\n\n\nServing\n\n\nAt the bottom of the main file, make sure to run your \nDroplet\n.\n\n\ndrop\n.\nrun\n()\n\n\n\n\n\n\nSave the file, and switch back to the terminal.\n\n\nCompile \n Run\n\n\nBuilding\n\n\nA big part of what makes Vapor so great is Swift's state of the art compiler. Let's fire it up. Make sure you are in the root directory of the project and run the following command.\n\n\nvapor\n \nbuild\n\n\n\n\n\n\n\n\nNote\n\n\nvapor build\n runs \nswift build\n in the background.\n\n\n\n\nThe Swift Package Manager will first start by downloading the appropriate dependencies from git. It will then compile and link these dependencies together.\n\n\nWhen the process has completed, you will see \nBuilding Project [Done]\n\n\n\n\nTip\n\n\nIf you see a message like \nunable to execute command: Killed\n, you need to increase your swap space. This can happen if you are running on a machine with limited memory.\n\n\n\n\nRelease\n\n\nBuilding your application in release mode takes longer, but increases performance.\n\n\nvapor build --release\n\n\n\n\n\nServing\n\n\nBoot up the server by running the following command.\n\n\nvapor run serve\n\n\n\n\n\nYou should see a message \nServer starting...\n. You can now visit \nhttp://localhost:8080/hello\n in your browser.\n\n\n\n\nNote\n\n\nCertain port numbers require super user access to bind. Simply run \nsudo vapor run\n to allow access. If you decide to run on a port besides \n80\n, make sure to direct your browser accordingly.\n\n\n\n\nProduction\n\n\nServing your application in the production environment increases its security and performance.\n\n\nvapor run serve --env\n=\nproduction\n\n\n\n\n\nDebug errors will be silenced while in the production environment, so make sure to check your logs for errors.\n\n\n\n\nWarning\n\n\nIf you compiled your application with \n--release\n, make sure to add that flag to the \nvapor run\n command as well. e.g., \nvapor run serve --env=production --release\n.\n\n\n\n\nHello, World\n\n\nYou should see the following output in your browser window.\n\n\nHello, world!\n\n\n\n\n\n\n\nSuccess\n\n\nLike Vapor so far? Click the button below and star the repo to help spread the word!", + "text": "Hello, World\n\n\nThis section assumes you have installed Swift 3.1 and the Vapor Toolbox and have verified they are working.\n\n\n\n\nTip\n\n\nNote: If you don't want to use the Toolbox, follow the \nmanual guide\n.\n\n\n\n\nNew Project\n\n\nLet's start by creating a new project called \"Hello, World\".\n\n\nvapor new Hello --template\n=\napi\n\n\n\n\n\nVapor's folder structure will probably look familiar to you if you have worked with other web frameworks.\n\n\nHello\n\u251c\u2500\u2500 Config\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 app.json\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 crypto.json\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 droplet.json\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 fluent.json\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 server.json\n\u251c\u2500\u2500 Package.pins\n\u251c\u2500\u2500 Package.swift\n\u251c\u2500\u2500 Public\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 Sources\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 App\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 Config+Setup.swift\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 Controllers\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 PostController.swift\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 Droplet+Setup.swift\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 Models\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 Post.swift\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 Routes.swift\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 Run\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 main.swift\n\u251c\u2500\u2500 Tests\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 AppTests\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 PostControllerTests.swift\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 RouteTests.swift\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 Utilities.swift\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 LinuxMain.swift\n\u251c\u2500\u2500 circle.yml\n\u2514\u2500\u2500 license\n\n\n\n\n\nFor our Hello, World project, we will be focusing on the \nRoutes.swift\n file.\n\n\nHello\n\u2514\u2500\u2500 Sources\n \u2514\u2500\u2500 App\n \u2514\u2500\u2500 Routes.swift\n\n\n\n\n\n\n\nTip\n\n\nThe \nvapor new\n command creates a new project with examples and comments about how to use the framework. You can delete these if you want.\n\n\n\n\nCode\n\n\nDroplet\n\n\nLook for the following line in the \nRoutes.swift\n file.\n\n\nfunc\n \nbuild\n(\n_\n \nbuilder\n:\n \nRouteBuilder\n)\n \nthrows\n\n\n\n\n\n\nThis method is where all the routes for our application will be added. \n\n\nRouting\n\n\nIn the scope of the \nbuild\n method, look for the following statement.\n\n\nbuilder\n.\nget\n(\nplaintext\n)\n \n{\n \nreq\n \nin\n\n \nreturn\n \nHello, world!\n\n\n}\n\n\n\n\n\n\nThis creates a new route that will match all \nGET\n requests to \n/plaintext\n.\n\n\nAll route closures are passed an instance of \nRequest\n that contains information such as the URI requested and data sent.\n\n\nThis route simply returns a string, but anything that is \nResponseRepresentable\n can be returned. Learn more in the \nRouting\n section of the guide.\n\n\n\n\nTip\n\n\nXcode autocomplete may add extraneous type information to your closure's input arguments. This can be deleted to keep the code clean. If you'd like to keep the type information add \nimport HTTP\n to the top of the file.\n\n\n\n\nCompile \n Run\n\n\nBuilding\n\n\nA big part of what makes Vapor so great is Swift's state of the art compiler. Let's fire it up. Make sure you are in the root directory of the project and run the following command.\n\n\nvapor\n \nbuild\n\n\n\n\n\n\n\n\nNote\n\n\nvapor build\n runs \nswift build\n in the background.\n\n\n\n\nThe Swift Package Manager will first start by downloading the appropriate dependencies from git. It will then compile and link these dependencies together.\n\n\nWhen the process has completed, you will see \nBuilding Project [Done]\n\n\n\n\nTip\n\n\nIf you see a message like \nunable to execute command: Killed\n, you need to increase your swap space. This can happen if you are running on a machine with limited memory.\n\n\n\n\nRelease\n\n\nBuilding your application in release mode takes longer, but increases performance.\n\n\nvapor build --release\n\n\n\n\n\nServing\n\n\nBoot up the server by running the following command.\n\n\nvapor run serve\n\n\n\n\n\nYou should see a message \nServer starting...\n. You can now visit \nhttp://localhost:8080/plaintext\n in your browser.\n\n\n\n\nNote\n\n\nCertain port numbers require super user access to bind. Simply run \nsudo vapor run\n to allow access. If you decide to run on a port besides \n80\n, make sure to direct your browser accordingly.\n\n\n\n\nProduction\n\n\nServing your application in the production environment increases its security and performance.\n\n\nvapor run serve --env\n=\nproduction\n\n\n\n\n\nDebug errors will be silenced while in the production environment, so make sure to check your logs for errors.\n\n\n\n\nWarning\n\n\nIf you compiled your application with \n--release\n, make sure to add that flag to the \nvapor run\n command as well. e.g., \nvapor run serve --env=production --release\n.\n\n\n\n\nHello, World\n\n\nYou should see the following output in your browser window.\n\n\nHello, world!\n\n\n\n\n\n\n\nSuccess\n\n\nLike Vapor so far? Click the button below and star the repo to help spread the word!", "title": "Hello, World" }, { @@ -232,7 +237,7 @@ }, { "location": "/getting-started/hello-world/#new-project", - "text": "Let's start by creating a new project called \"Hello, World\". vapor new Hello --template = api Warning Use vapor new Hello --template=api --branch=beta while Vapor 2 is in beta Vapor's folder structure will probably look familiar to you if you have worked with other web frameworks. Hello\n\u251c\u2500\u2500 Sources\n\u2502 \u2514\u2500\u2500 App\n\u2502 \u2514\u2500\u2500 Controllers\n\u2502 \u2514\u2500\u2500 Middleware\n\u2502 \u2514\u2500\u2500 Models\n\u2502 \u2514\u2500\u2500 main.swift\n\u251c\u2500\u2500 Public\n\u251c\u2500\u2500 Resources\n\u2502 \u2514\u2500\u2500 Views\n\u2514\u2500\u2500 Package.swift For our Hello, World project, we will be focusing on the main.swift file. Hello\n\u2514\u2500\u2500 Sources\n \u2514\u2500\u2500 App\n \u2514\u2500\u2500 main.swift Tip The vapor new command creates a new project with examples and comments about how to use the framework. You can delete these if you want.", + "text": "Let's start by creating a new project called \"Hello, World\". vapor new Hello --template = api Vapor's folder structure will probably look familiar to you if you have worked with other web frameworks. Hello\n\u251c\u2500\u2500 Config\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 app.json\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 crypto.json\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 droplet.json\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 fluent.json\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 server.json\n\u251c\u2500\u2500 Package.pins\n\u251c\u2500\u2500 Package.swift\n\u251c\u2500\u2500 Public\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 Sources\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 App\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 Config+Setup.swift\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 Controllers\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 PostController.swift\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 Droplet+Setup.swift\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 Models\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 Post.swift\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 Routes.swift\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 Run\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 main.swift\n\u251c\u2500\u2500 Tests\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 AppTests\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 PostControllerTests.swift\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 RouteTests.swift\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 Utilities.swift\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 LinuxMain.swift\n\u251c\u2500\u2500 circle.yml\n\u2514\u2500\u2500 license For our Hello, World project, we will be focusing on the Routes.swift file. Hello\n\u2514\u2500\u2500 Sources\n \u2514\u2500\u2500 App\n \u2514\u2500\u2500 Routes.swift Tip The vapor new command creates a new project with examples and comments about how to use the framework. You can delete these if you want.", "title": "New Project" }, { @@ -242,19 +247,14 @@ }, { "location": "/getting-started/hello-world/#droplet", - "text": "Look for the following line in the main.swift file. let drop = try Droplet () This is where the one and only Droplet for this example will be created. The Droplet class has a plethora of useful functions on it, and is used extensively.", + "text": "Look for the following line in the Routes.swift file. func build ( _ builder : RouteBuilder ) throws This method is where all the routes for our application will be added.", "title": "Droplet" }, { "location": "/getting-started/hello-world/#routing", - "text": "Right after the creation of drop , add the following code snippet. drop . get ( hello ) { request in \n return Hello, world! } This creates a new route on the Droplet that will match all GET requests to /hello . All route closures are passed an instance of Request that contains information such as the URI requested and data sent. This route simply returns a string, but anything that is ResponseRepresentable can be returned. Learn more in the Routing section of the guide. Tip Xcode autocomplete may add extraneous type information to your closure's input arguments. This can be deleted to keep the code clean. If you'd like to keep the type information add import HTTP to the top of the file.", + "text": "In the scope of the build method, look for the following statement. builder . get ( plaintext ) { req in \n return Hello, world! } This creates a new route that will match all GET requests to /plaintext . All route closures are passed an instance of Request that contains information such as the URI requested and data sent. This route simply returns a string, but anything that is ResponseRepresentable can be returned. Learn more in the Routing section of the guide. Tip Xcode autocomplete may add extraneous type information to your closure's input arguments. This can be deleted to keep the code clean. If you'd like to keep the type information add import HTTP to the top of the file.", "title": "Routing" }, - { - "location": "/getting-started/hello-world/#serving", - "text": "At the bottom of the main file, make sure to run your Droplet . drop . run () Save the file, and switch back to the terminal.", - "title": "Serving" - }, { "location": "/getting-started/hello-world/#compile-run", "text": "", @@ -271,8 +271,8 @@ "title": "Release" }, { - "location": "/getting-started/hello-world/#serving_1", - "text": "Boot up the server by running the following command. vapor run serve You should see a message Server starting... . You can now visit http://localhost:8080/hello in your browser. Note Certain port numbers require super user access to bind. Simply run sudo vapor run to allow access. If you decide to run on a port besides 80 , make sure to direct your browser accordingly.", + "location": "/getting-started/hello-world/#serving", + "text": "Boot up the server by running the following command. vapor run serve You should see a message Server starting... . You can now visit http://localhost:8080/plaintext in your browser. Note Certain port numbers require super user access to bind. Simply run sudo vapor run to allow access. If you decide to run on a port besides 80 , make sure to direct your browser accordingly.", "title": "Serving" }, { @@ -392,7 +392,7 @@ }, { "location": "/vapor/droplet/", - "text": "Droplet\n\n\nThe \nDroplet\n is a service container that gives you access to many of Vapor's facilities. It is responsible for registering routes, starting the server, appending middleware, and more.\n\n\n\n\nTip\n\n\nNormally applications will only have one Droplet. However, for advanced use cases, it is possible to create more than one.\n\n\n\n\nInitialization\n\n\nAs you have probably already seen, the only thing required to create an instance of \nDroplet\n is to import Vapor.\n\n\nimport\n \nVapor\n\n\n\nlet\n \ndrop\n \n=\n \ntry\n \nDroplet\n()\n\n\n\n// your magic here\n\n\n\ntry\n \ndrop\n.\nrun\n()\n\n\n\n\n\n\nCreation of the \nDroplet\n normally happens in the \nmain.swift\n file. \n\n\n\n\nNote\n\n\nFor the sake of simplicity, most of the documentations sample code uses just the \nmain.swift\n file. See the \nmodules\n section in Advanced to learn more about using multiple modules.\n\n\n\n\nEnvironment\n\n\nThe \nenvironment\n property contains the current environment your application is running in. Usually development, testing, or production.\n\n\nif\n \ndrop\n.\nenvironment\n \n==\n \n.\nproduction\n \n{\n\n \n...\n\n\n}\n\n\n\n\n\n\nThe environment affects \nConfig\n and \nLogging\n. The environment is \ndevelopment\n by default. To change it, pass the \n--env=\n flag as an argument.\n\n\nvapor run serve --env\n=\nproduction\n\n\n\n\n\nIf you are in Xcode, you can pass arguments through the scheme editor.\n\n\n\n\nWarning\n\n\nDebug logs can reduce the number of requests your application can handle per second. Enable production mode to silence non-critical logs.\n\n\n\n\nWorking Directory\n\n\nThe \nworkDir\n property contains a path to the current working directory of the application. Vapor uses this property to find the folders related to your project, such as \nResources\n, \nPublic\n, and \nConfig\n.\n\n\nprint\n(\ndrop\n.\nworkDir\n)\n \n// /var/www/my-project/\n\n\n\n\n\n\nVapor automatically determines the working directory in most situations. However, you may need to manually set it for advanced use cases.\n\n\nYou can override the working directory through the \nDroplet\n's initializer, or by passing the \n--workdir\n argument.\n\n\nvapor run serve --workdir\n=\n/var/www/my-project\n\n\n\n\n\n\nModifying Properties\n\n\nThe \nDroplet\n's properties can be changed programmatically or through configuration.\n\n\nProgrammatic\n\n\nProperties on the \nDroplet\n are constant and can be overridden through the init method.\n\n\nlet\n \ndrop\n \n=\n \ntry\n \nDroplet\n(\nserver\n:\n \nMyServerType\n.\nself\n)\n\n\n\n\n\n\nHere the type of server the \nDroplet\n uses is changed to a custom type. When the \nDroplet\n is run, this custom server type will be booted instead of the default server.\n\n\n\n\nWarning\n\n\nUsing the init method manually can override configured properties.\n\n\n\n\nConfigurable\n\n\nIf you want to modify a property of the \nDroplet\n only in certain cases, you can use \naddConfigurable\n. Say for example you want to email error logs to yourself in production, but you don't want to spam your inbox while developing.\n\n\nlet\n \nconfig\n \n=\n \ntry\n \nConfig\n()\n\n\nconfig\n.\naddConfigurable\n(\nlog\n:\n \nMyEmailLogger\n.\nself\n,\n \nname\n:\n \nemail\n)\n\n\n\nlet\n \ndrop\n \n=\n \nDroplet\n(\nconfig\n)\n\n\n\n\n\n\nThe \nDroplet\n will continue to use the default logger until you modify the \nConfig/droplet.json\n file to point to your email logger. If this is done in \nConfig/production/droplet.json\n, then your logger will only be used in production.\n\n\n{\n\n \nlog\n:\n \nemail\n\n\n}\n\n\n\n\n\n\nSupported Properties\n\n\n\n\n\n\n\n\nProperty\n\n\nType\n\n\ndroplet.json\n key\n\n\nConfig Initializable\n\n\n\n\n\n\n\n\n\n\nserver\n\n\nServerProtocol.Type\n\n\nserver\n\n\nno\n\n\n\n\n\n\nclient\n\n\nClientProtocol.Type\n\n\nclient\n\n\nno\n\n\n\n\n\n\nlog\n\n\nLogProtocol\n\n\nlog\n\n\nyes\n\n\n\n\n\n\nhash\n\n\nHashProtocol\n\n\nhash\n\n\nyes\n\n\n\n\n\n\ncipher\n\n\nCipherProtocol\n\n\ncipher\n\n\nyes\n\n\n\n\n\n\nmiddleware\n\n\nMiddleware\n\n\nmiddleware.[server,client]\n\n\nno\n\n\n\n\n\n\nconsole\n\n\nConsoleProtocol\n\n\nconsole\n\n\nyes\n\n\n\n\n\n\ncache\n\n\nCacheProtocol\n\n\ncache\n\n\nyes\n\n\n\n\n\n\n\n\nExample\n\n\nLet's create a custom logger to demonstrate Vapor's configurable properties.\n\n\nAllCapsLogger.swift\n\n\nfinal\n \nclass\n \nAllCapsLogger\n:\n \nLogProtocol\n \n{\n\n \nvar\n \nenabled\n:\n \n[\nLogLevel\n]\n \n=\n \n[]\n\n \nfunc\n \nlog\n(\n_\n \nlevel\n:\n \nLogLevel\n,\n \nmessage\n:\n \nString\n,\n \nfile\n:\n \nString\n,\n \nfunction\n:\n \nString\n,\n \nline\n:\n \nInt\n)\n \n{\n\n \nprint\n(\nmessage\n.\nuppercased\n \n+\n \n!!!\n)\n\n \n}\n\n\n}\n\n\n\n\n\n\nNow add the logger to the Droplet using the \naddConfigurable\n method for logs.\n\n\nmain.swift\n\n\nlet\n \nconfig\n \n=\n \ntry\n \nConfig\n()\n\n\nconfig\n.\naddConfigurable\n(\nlog\n:\n \nAllCapsLogger\n(),\n \nname\n:\n \nall-caps\n)\n\n\n\nlet\n \ndrop\n \n=\n \ntry\n \nDroplet\n(\nconfig\n)\n\n\n\n\n\n\nWhenever the \n\"log\"\n property is set to \n\"all-caps\"\n in the \ndroplet.json\n, our new logger will be used. \n\n\nConfig/development/droplet.json\n\n\n{\n\n \nlog\n:\n \nall-caps\n\n\n}\n\n\n\n\n\n\nHere we are setting our logger only in the \ndevelopment\n environment. All other environments will use Vapor's default logger.\n\n\nConfig Initializable\n\n\nFor an added layer of convenience, you can allow your custom types to be initialized from configuration files.\n\n\nIn our previous example, we initialized an \nAllCapsLogger\n before adding it to the Droplet.\n\n\nLet's say we want to allow our project to configure how many exclamation points get added with each log message.\n\n\nAllCapsLogger.swift\n\n\nfinal\n \nclass\n \nAllCapsLogger\n:\n \nLogProtocol\n \n{\n\n \nvar\n \nenabled\n:\n \n[\nLogLevel\n]\n \n=\n \n[]\n\n \nlet\n \nexclamationCount\n:\n \nInt\n\n\n \ninit\n(\nexclamationCount\n:\n \nInt\n)\n \n{\n\n \nself\n.\nexclamationCount\n \n=\n \nexclamationCount\n\n \n}\n\n\n \nfunc\n \nlog\n(\n_\n \nlevel\n:\n \nLogLevel\n,\n \nmessage\n:\n \nString\n,\n \nfile\n:\n \nString\n,\n \nfunction\n:\n \nString\n,\n \nline\n:\n \nInt\n)\n \n{\n\n \nprint\n(\nmessage\n.\nuppercased\n \n+\n \nString\n(\nrepeating\n:\n \n!\n,\n \ncount\n:\n \nexclamationCount\n))\n\n \n}\n\n\n}\n\n\n\nextension\n \nAllCapsLogger\n:\n \nConfigInitializable\n \n{\n\n \ninit\n(\nconfig\n:\n \nConfig\n)\n \nthrows\n \n{\n\n \nlet\n \ncount\n \n=\n \nconfig\n[\nallCaps\n,\n \nexclamationCount\n]?.\nint\n \n??\n \n3\n\n \nself\n.\ninit\n(\nexclamationCount\n:\n \ncount\n)\n\n \n}\n \n\n}\n\n\n\n\n\n\n\n\nNote\n\n\nThe first parameter to \nconfig\n is the name of the file.\n\n\n\n\nNow that we have conformed our logger to \nConfigInitializable\n, we can pass just the type name to \naddConfigurable\n.\n\n\nmain.swift\n\n\nlet\n \nconfig\n \n=\n \ntry\n \nConfig\n()\n\n\nconfig\n.\naddConfigurable\n(\nlog\n:\n \nAllCapsLogger\n.\nself\n,\n \nname\n:\n \nall-caps\n)\n\n\n\nlet\n \ndrop\n \n=\n \ntry\n \nDroplet\n(\nconfig\n)\n\n\n\n\n\n\nNow if you add a file named \nallCaps.json\n to the \nConfig\n folder, you can configure the logger.\n\n\nallCaps.json\n\n\n{\n\n \nexclamationCount\n:\n \n5\n\n\n}\n\n\n\n\n\n\nWith this configurable abstraction, you can easily change how your application functions in different environments without needing to hard code these values into your source code.", + "text": "Droplet\n\n\nThe \nDroplet\n is a service container that gives you access to many of Vapor's facilities. It is responsible for registering routes, starting the server, appending middleware, and more.\n\n\n\n\nTip\n\n\nNormally applications will only have one Droplet. However, for advanced use cases, it is possible to create more than one.\n\n\n\n\nInitialization\n\n\nAs you have probably already seen, the only thing required to create an instance of \nDroplet\n is to import Vapor.\n\n\nimport\n \nVapor\n\n\n\nlet\n \ndrop\n \n=\n \ntry\n \nDroplet\n()\n\n\n\n// your magic here\n\n\n\ntry\n \ndrop\n.\nrun\n()\n\n\n\n\n\n\nCreation of the \nDroplet\n normally happens in the \nmain.swift\n file. \n\n\n\n\nNote\n\n\nFor the sake of simplicity, most of the documentations sample code uses just the \nmain.swift\n file. See the \nmodules\n section in Advanced to learn more about using multiple modules.\n\n\n\n\nEnvironment\n\n\nThe \nenvironment\n property contains the current environment your application is running in. Usually development, testing, or production.\n\n\nif\n \ndrop\n.\nenvironment\n \n==\n \n.\nproduction\n \n{\n\n \n...\n\n\n}\n\n\n\n\n\n\nThe environment affects \nConfig\n and \nLogging\n. The environment is \ndevelopment\n by default. To change it, pass the \n--env=\n flag as an argument.\n\n\nvapor run serve --env\n=\nproduction\n\n\n\n\n\nIf you are in Xcode, you can pass arguments through the scheme editor.\n\n\n\n\nWarning\n\n\nDebug logs can reduce the number of requests your application can handle per second. Enable production mode to silence non-critical logs.\n\n\n\n\nWorking Directory\n\n\nThe \nworkDir\n property contains a path to the current working directory of the application. Vapor uses this property to find the folders related to your project, such as \nResources\n, \nPublic\n, and \nConfig\n.\n\n\nprint\n(\ndrop\n.\nworkDir\n)\n \n// /var/www/my-project/\n\n\n\n\n\n\nVapor automatically determines the working directory in most situations. However, you may need to manually set it for advanced use cases.\n\n\nYou can override the working directory through the \nDroplet\n's initializer, or by passing the \n--workdir\n argument.\n\n\nvapor run serve --workdir\n=\n/var/www/my-project\n\n\n\n\n\n\nModifying Properties\n\n\nThe \nDroplet\n's properties can be changed programmatically or through configuration.\n\n\nProgrammatic\n\n\nProperties on the \nDroplet\n are constant and can be overridden through the init method.\n\n\nlet\n \ndrop\n \n=\n \ntry\n \nDroplet\n(\nserver\n:\n \nMyServerType\n.\nself\n)\n\n\n\n\n\n\nHere the type of server the \nDroplet\n uses is changed to a custom type. When the \nDroplet\n is run, this custom server type will be booted instead of the default server.\n\n\n\n\nWarning\n\n\nUsing the init method manually can override configured properties.\n\n\n\n\nConfigurable\n\n\nIf you want to modify a property of the \nDroplet\n only in certain cases, you can use \naddConfigurable\n. Say for example you want to email error logs to yourself in production, but you don't want to spam your inbox while developing.\n\n\nlet\n \nconfig\n \n=\n \ntry\n \nConfig\n()\n\n\nconfig\n.\naddConfigurable\n(\nlog\n:\n \nMyEmailLogger\n.\ninit\n,\n \nname\n:\n \nemail\n)\n\n\n\nlet\n \ndrop\n \n=\n \nDroplet\n(\nconfig\n)\n\n\n\n\n\n\nThe \nDroplet\n will continue to use the default logger until you modify the \nConfig/droplet.json\n file to point to your email logger. If this is done in \nConfig/production/droplet.json\n, then your logger will only be used in production.\n\n\n{\n\n \nlog\n:\n \nemail\n\n\n}\n\n\n\n\n\n\nSupported Properties\n\n\n\n\n\n\n\n\nProperty\n\n\nType\n\n\ndroplet.json\n key\n\n\nConfig Initializable\n\n\n\n\n\n\n\n\n\n\nserver\n\n\nServerProtocol.Type\n\n\nserver\n\n\nno\n\n\n\n\n\n\nclient\n\n\nClientProtocol.Type\n\n\nclient\n\n\nno\n\n\n\n\n\n\nlog\n\n\nLogProtocol\n\n\nlog\n\n\nyes\n\n\n\n\n\n\nhash\n\n\nHashProtocol\n\n\nhash\n\n\nyes\n\n\n\n\n\n\ncipher\n\n\nCipherProtocol\n\n\ncipher\n\n\nyes\n\n\n\n\n\n\nmiddleware\n\n\nMiddleware\n\n\nmiddleware.[server,client]\n\n\nno\n\n\n\n\n\n\nconsole\n\n\nConsoleProtocol\n\n\nconsole\n\n\nyes\n\n\n\n\n\n\ncache\n\n\nCacheProtocol\n\n\ncache\n\n\nyes\n\n\n\n\n\n\n\n\nExample\n\n\nLet's create a custom logger to demonstrate Vapor's configurable properties.\n\n\nAllCapsLogger.swift\n\n\nfinal\n \nclass\n \nAllCapsLogger\n:\n \nLogProtocol\n \n{\n\n \nvar\n \nenabled\n:\n \n[\nLogLevel\n]\n \n=\n \n[]\n\n \nfunc\n \nlog\n(\n_\n \nlevel\n:\n \nLogLevel\n,\n \nmessage\n:\n \nString\n,\n \nfile\n:\n \nString\n,\n \nfunction\n:\n \nString\n,\n \nline\n:\n \nInt\n)\n \n{\n\n \nprint\n(\nmessage\n.\nuppercased\n \n+\n \n!!!\n)\n\n \n}\n\n\n}\n\n\n\n\n\n\nNow add the logger to the Droplet using the \naddConfigurable\n method for logs.\n\n\nmain.swift\n\n\nlet\n \nconfig\n \n=\n \ntry\n \nConfig\n()\n\n\nconfig\n.\naddConfigurable\n(\nlog\n:\n \nAllCapsLogger\n(),\n \nname\n:\n \nall-caps\n)\n\n\n\nlet\n \ndrop\n \n=\n \ntry\n \nDroplet\n(\nconfig\n)\n\n\n\n\n\n\nWhenever the \n\"log\"\n property is set to \n\"all-caps\"\n in the \ndroplet.json\n, our new logger will be used. \n\n\nConfig/development/droplet.json\n\n\n{\n\n \nlog\n:\n \nall-caps\n\n\n}\n\n\n\n\n\n\nHere we are setting our logger only in the \ndevelopment\n environment. All other environments will use Vapor's default logger.\n\n\nConfig Initializable\n\n\nFor an added layer of convenience, you can allow your custom types to be initialized from configuration files.\n\n\nIn our previous example, we initialized an \nAllCapsLogger\n before adding it to the Droplet.\n\n\nLet's say we want to allow our project to configure how many exclamation points get added with each log message.\n\n\nAllCapsLogger.swift\n\n\nfinal\n \nclass\n \nAllCapsLogger\n:\n \nLogProtocol\n \n{\n\n \nvar\n \nenabled\n:\n \n[\nLogLevel\n]\n \n=\n \n[]\n\n \nlet\n \nexclamationCount\n:\n \nInt\n\n\n \ninit\n(\nexclamationCount\n:\n \nInt\n)\n \n{\n\n \nself\n.\nexclamationCount\n \n=\n \nexclamationCount\n\n \n}\n\n\n \nfunc\n \nlog\n(\n_\n \nlevel\n:\n \nLogLevel\n,\n \nmessage\n:\n \nString\n,\n \nfile\n:\n \nString\n,\n \nfunction\n:\n \nString\n,\n \nline\n:\n \nInt\n)\n \n{\n\n \nprint\n(\nmessage\n.\nuppercased\n \n+\n \nString\n(\nrepeating\n:\n \n!\n,\n \ncount\n:\n \nexclamationCount\n))\n\n \n}\n\n\n}\n\n\n\nextension\n \nAllCapsLogger\n:\n \nConfigInitializable\n \n{\n\n \ninit\n(\nconfig\n:\n \nConfig\n)\n \nthrows\n \n{\n\n \nlet\n \ncount\n \n=\n \nconfig\n[\nallCaps\n,\n \nexclamationCount\n]?.\nint\n \n??\n \n3\n\n \nself\n.\ninit\n(\nexclamationCount\n:\n \ncount\n)\n\n \n}\n \n\n}\n\n\n\n\n\n\n\n\nNote\n\n\nThe first parameter to \nconfig\n is the name of the file.\n\n\n\n\nNow that we have conformed our logger to \nConfigInitializable\n, we can pass just the type name to \naddConfigurable\n.\n\n\nmain.swift\n\n\nlet\n \nconfig\n \n=\n \ntry\n \nConfig\n()\n\n\nconfig\n.\naddConfigurable\n(\nlog\n:\n \nAllCapsLogger\n.\nself\n,\n \nname\n:\n \nall-caps\n)\n\n\n\nlet\n \ndrop\n \n=\n \ntry\n \nDroplet\n(\nconfig\n)\n\n\n\n\n\n\nNow if you add a file named \nallCaps.json\n to the \nConfig\n folder, you can configure the logger.\n\n\nallCaps.json\n\n\n{\n\n \nexclamationCount\n:\n \n5\n\n\n}\n\n\n\n\n\n\nWith this configurable abstraction, you can easily change how your application functions in different environments without needing to hard code these values into your source code.", "title": "Droplet" }, { @@ -427,7 +427,7 @@ }, { "location": "/vapor/droplet/#configurable", - "text": "If you want to modify a property of the Droplet only in certain cases, you can use addConfigurable . Say for example you want to email error logs to yourself in production, but you don't want to spam your inbox while developing. let config = try Config () config . addConfigurable ( log : MyEmailLogger . self , name : email ) let drop = Droplet ( config ) The Droplet will continue to use the default logger until you modify the Config/droplet.json file to point to your email logger. If this is done in Config/production/droplet.json , then your logger will only be used in production. { \n log : email }", + "text": "If you want to modify a property of the Droplet only in certain cases, you can use addConfigurable . Say for example you want to email error logs to yourself in production, but you don't want to spam your inbox while developing. let config = try Config () config . addConfigurable ( log : MyEmailLogger . init , name : email ) let drop = Droplet ( config ) The Droplet will continue to use the default logger until you modify the Config/droplet.json file to point to your email logger. If this is done in Config/production/droplet.json , then your logger will only be used in production. { \n log : email }", "title": "Configurable" }, { @@ -2781,24 +2781,59 @@ "title": "Modules" }, { - "location": "/switch/1_5/", + "location": "/version/1_5/", "text": "Redirecting...", "title": "1.5" }, { - "location": "/switch/1_5/#redirecting", + "location": "/version/1_5/#redirecting", "text": "", "title": "Redirecting..." }, { - "location": "/switch/2_0/", + "location": "/version/2_0/", "text": "Redirecting...", "title": "2.0" }, { - "location": "/switch/2_0/#redirecting", + "location": "/version/2_0/#redirecting", "text": "", "title": "Redirecting..." + }, + { + "location": "/version/support/", + "text": "Version Support\n\n\n\n\nVapor 2.0 is currently active.\nVapor 1.5 is being maintained until November 2017.\n\n\n\n\nWarning\n\n\nDashed blocks and lines represent the team's goals and are not yet guaranteed. \nVapor 3's release and the beginning of Vapor 2's maintenance phase have not yet been decided.\n\n\n\n\nCore\n\n\nAll packages in the \nVapor GitHub\n are maintained according to the following rules.\n\n\nActive\n\n\nWhile a version is active, reported security issues and bugs are fixed.\n\n\nAdditionally, new features and optimizations may be added. If new API is added, the minor version number will be incremented. At no point can existing API be removed or broken during an active version. Semver is strictly followed and tested.\n\n\nMaintenance\n\n\nWhen a new version of Vapor is released, the previous version will enter a maintenance phase which lasts for six months. During this phase, critical security issues and bugs will be fixed. No new features will be added.\n\n\n\n\nNote\n\n\nOnly the latest minor version will be maintained.\n\n\n\n\nUnstable\n\n\nThe master branch is the latest development version of Vapor and is constantly changing. Before a new version of Vapor is released, there may be unstable alpha and beta phases in which you are welcome to test and provide feedback on the changes.\n\n\nCommunity\n\n\nAll packages in the \nVapor Community GitHub\n are maintained in strict accordance of semver. Violations of semver should be reported as issues to the offending package's GitHub page.", + "title": "Support" + }, + { + "location": "/version/support/#version-support", + "text": "Vapor 2.0 is currently active.\nVapor 1.5 is being maintained until November 2017. Warning Dashed blocks and lines represent the team's goals and are not yet guaranteed. \nVapor 3's release and the beginning of Vapor 2's maintenance phase have not yet been decided.", + "title": "Version Support" + }, + { + "location": "/version/support/#core", + "text": "All packages in the Vapor GitHub are maintained according to the following rules.", + "title": "Core" + }, + { + "location": "/version/support/#active", + "text": "While a version is active, reported security issues and bugs are fixed. Additionally, new features and optimizations may be added. If new API is added, the minor version number will be incremented. At no point can existing API be removed or broken during an active version. Semver is strictly followed and tested.", + "title": "Active" + }, + { + "location": "/version/support/#maintenance", + "text": "When a new version of Vapor is released, the previous version will enter a maintenance phase which lasts for six months. During this phase, critical security issues and bugs will be fixed. No new features will be added. Note Only the latest minor version will be maintained.", + "title": "Maintenance" + }, + { + "location": "/version/support/#unstable", + "text": "The master branch is the latest development version of Vapor and is constantly changing. Before a new version of Vapor is released, there may be unstable alpha and beta phases in which you are welcome to test and provide feedback on the changes.", + "title": "Unstable" + }, + { + "location": "/version/support/#community", + "text": "All packages in the Vapor Community GitHub are maintained in strict accordance of semver. Violations of semver should be reported as issues to the offending package's GitHub page.", + "title": "Community" } ] } \ No newline at end of file diff --git a/build/2.0/mysql/driver/index.html b/build/2.0/mysql/driver/index.html index 19b93740..213259dd 100644 --- a/build/2.0/mysql/driver/index.html +++ b/build/2.0/mysql/driver/index.html @@ -1453,7 +1453,7 @@
  • - + 1.5
  • @@ -1465,12 +1465,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/mysql/package/index.html b/build/2.0/mysql/package/index.html index 68773583..b546ee34 100644 --- a/build/2.0/mysql/package/index.html +++ b/build/2.0/mysql/package/index.html @@ -1453,7 +1453,7 @@
  • - + 1.5
  • @@ -1465,12 +1465,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/mysql/provider/index.html b/build/2.0/mysql/provider/index.html index 440ef7bd..ffcf354d 100644 --- a/build/2.0/mysql/provider/index.html +++ b/build/2.0/mysql/provider/index.html @@ -1501,7 +1501,7 @@
  • - + 1.5
  • @@ -1513,12 +1513,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/node/package/index.html b/build/2.0/node/package/index.html index 4c13ff64..13ad66a5 100644 --- a/build/2.0/node/package/index.html +++ b/build/2.0/node/package/index.html @@ -1446,7 +1446,7 @@
  • - + 1.5
  • @@ -1458,12 +1458,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/redis/package/index.html b/build/2.0/redis/package/index.html index b7d111ba..8ded4700 100644 --- a/build/2.0/redis/package/index.html +++ b/build/2.0/redis/package/index.html @@ -1446,7 +1446,7 @@
  • - + 1.5
  • @@ -1458,12 +1458,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/redis/provider/index.html b/build/2.0/redis/provider/index.html index 77fa0f27..0c0bb919 100644 --- a/build/2.0/redis/provider/index.html +++ b/build/2.0/redis/provider/index.html @@ -1480,7 +1480,7 @@
  • - + 1.5
  • @@ -1492,12 +1492,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/routing/collection/index.html b/build/2.0/routing/collection/index.html index c4f03765..1a983820 100644 --- a/build/2.0/routing/collection/index.html +++ b/build/2.0/routing/collection/index.html @@ -1446,7 +1446,7 @@
  • - + 1.5
  • @@ -1458,12 +1458,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/routing/group/index.html b/build/2.0/routing/group/index.html index 1e4aba02..51d5f481 100644 --- a/build/2.0/routing/group/index.html +++ b/build/2.0/routing/group/index.html @@ -1467,7 +1467,7 @@
  • - + 1.5
  • @@ -1479,12 +1479,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/routing/overview/index.html b/build/2.0/routing/overview/index.html index 2ef446aa..2b732484 100644 --- a/build/2.0/routing/overview/index.html +++ b/build/2.0/routing/overview/index.html @@ -1501,7 +1501,7 @@
  • - + 1.5
  • @@ -1513,12 +1513,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/routing/package/index.html b/build/2.0/routing/package/index.html index 697bd601..e7e5d6bc 100644 --- a/build/2.0/routing/package/index.html +++ b/build/2.0/routing/package/index.html @@ -1412,7 +1412,7 @@
  • - + 1.5
  • @@ -1424,12 +1424,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/routing/parameters/index.html b/build/2.0/routing/parameters/index.html index 5b6461d6..9ca8b1a8 100644 --- a/build/2.0/routing/parameters/index.html +++ b/build/2.0/routing/parameters/index.html @@ -1466,7 +1466,7 @@
  • - + 1.5
  • @@ -1478,12 +1478,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/sessions/sessions/index.html b/build/2.0/sessions/sessions/index.html index a4c6d1e2..bc9dc834 100644 --- a/build/2.0/sessions/sessions/index.html +++ b/build/2.0/sessions/sessions/index.html @@ -1480,7 +1480,7 @@
  • - + 1.5
  • @@ -1492,12 +1492,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/settings/config/index.html b/build/2.0/settings/config/index.html index 1774d958..00b2ea5e 100644 --- a/build/2.0/settings/config/index.html +++ b/build/2.0/settings/config/index.html @@ -1533,7 +1533,7 @@
  • - + 1.5
  • @@ -1545,12 +1545,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/sitemap.xml b/build/2.0/sitemap.xml index 23b6b026..ce633641 100644 --- a/build/2.0/sitemap.xml +++ b/build/2.0/sitemap.xml @@ -464,13 +464,19 @@ - /switch/1_5/ + /version/1_5/ 2017-05-18 daily - /switch/2_0/ + /version/2_0/ + 2017-05-18 + daily + + + + /version/support/ 2017-05-18 daily diff --git a/build/2.0/validation/overview/index.html b/build/2.0/validation/overview/index.html index 7b27ba62..b798183b 100644 --- a/build/2.0/validation/overview/index.html +++ b/build/2.0/validation/overview/index.html @@ -1468,7 +1468,7 @@
  • - + 1.5
  • @@ -1480,12 +1480,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/vapor/commands/index.html b/build/2.0/vapor/commands/index.html index ad3c66d1..316058e8 100644 --- a/build/2.0/vapor/commands/index.html +++ b/build/2.0/vapor/commands/index.html @@ -1439,7 +1439,7 @@
  • - + 1.5
  • @@ -1451,12 +1451,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/vapor/controllers/index.html b/build/2.0/vapor/controllers/index.html index be01a60d..5cda7243 100644 --- a/build/2.0/vapor/controllers/index.html +++ b/build/2.0/vapor/controllers/index.html @@ -1473,7 +1473,7 @@
  • - + 1.5
  • @@ -1485,12 +1485,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/vapor/droplet/index.html b/build/2.0/vapor/droplet/index.html index aac71ad4..633b22f9 100644 --- a/build/2.0/vapor/droplet/index.html +++ b/build/2.0/vapor/droplet/index.html @@ -1507,7 +1507,7 @@
  • - + 1.5
  • @@ -1519,12 +1519,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + @@ -1709,7 +1721,7 @@

    Configurable

    If you want to modify a property of the Droplet only in certain cases, you can use addConfigurable. Say for example you want to email error logs to yourself in production, but you don't want to spam your inbox while developing.

    let config = try Config()
    -config.addConfigurable(log: MyEmailLogger.self, name: "email")
    +config.addConfigurable(log: MyEmailLogger.init, name: "email")
     
     let drop = Droplet(config)
     
    diff --git a/build/2.0/vapor/folder-structure/index.html b/build/2.0/vapor/folder-structure/index.html index e61f300d..70917ec0 100644 --- a/build/2.0/vapor/folder-structure/index.html +++ b/build/2.0/vapor/folder-structure/index.html @@ -1467,7 +1467,7 @@
  • - + 1.5
  • @@ -1479,12 +1479,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/vapor/hash/index.html b/build/2.0/vapor/hash/index.html index 65c0a82e..c47d7518 100644 --- a/build/2.0/vapor/hash/index.html +++ b/build/2.0/vapor/hash/index.html @@ -1573,7 +1573,7 @@
  • - + 1.5
  • @@ -1585,12 +1585,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/vapor/log/index.html b/build/2.0/vapor/log/index.html index f856acb4..07947b7e 100644 --- a/build/2.0/vapor/log/index.html +++ b/build/2.0/vapor/log/index.html @@ -1412,7 +1412,7 @@
  • - + 1.5
  • @@ -1424,12 +1424,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/vapor/provider/index.html b/build/2.0/vapor/provider/index.html index 7e4fd2c1..2108d404 100644 --- a/build/2.0/vapor/provider/index.html +++ b/build/2.0/vapor/provider/index.html @@ -1500,7 +1500,7 @@
  • - + 1.5
  • @@ -1512,12 +1512,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/vapor/views/index.html b/build/2.0/vapor/views/index.html index 92d24820..02d7601d 100644 --- a/build/2.0/vapor/views/index.html +++ b/build/2.0/vapor/views/index.html @@ -1474,7 +1474,7 @@
  • - + 1.5
  • @@ -1486,12 +1486,24 @@
  • - + 2.0
  • + + + + + +
  • + + Support + +
  • + + diff --git a/build/2.0/switch/1_5/index.html b/build/2.0/version/1_5/index.html similarity index 99% rename from build/2.0/switch/1_5/index.html rename to build/2.0/version/1_5/index.html index e48dabf4..6f306c2d 100644 --- a/build/2.0/switch/1_5/index.html +++ b/build/2.0/version/1_5/index.html @@ -1432,6 +1432,18 @@ + + + + + +
  • + + Support + +
  • + + @@ -1463,7 +1475,7 @@
    - edit + edit diff --git a/build/2.0/switch/2_0/index.html b/build/2.0/version/2_0/index.html similarity index 97% rename from build/2.0/switch/2_0/index.html rename to build/2.0/version/2_0/index.html index de68f2bc..0f0d1a33 100644 --- a/build/2.0/switch/2_0/index.html +++ b/build/2.0/version/2_0/index.html @@ -1432,6 +1432,18 @@ + + + + + +
  • + + Support + +
  • + + @@ -1463,7 +1475,7 @@
    diff --git a/build/2.0/version/support/index.html b/build/2.0/version/support/index.html new file mode 100644 index 00000000..badf952d --- /dev/null +++ b/build/2.0/version/support/index.html @@ -0,0 +1,1685 @@ + + + + + + + + + + + + + + + + + + Support - Vapor Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
    + + +
    +
    + + +
    +
    +
    + +
    +
    +
    + + +
    +
    +
    + + +
    +
    +
    + + +
    +
    + + edit + + + +

    Version Support

    +

    Support Matrix

    +

    Vapor 2.0 is currently active. +Vapor 1.5 is being maintained until November 2017.

    +
    +

    Warning

    +

    Dashed blocks and lines represent the team's goals and are not yet guaranteed. +Vapor 3's release and the beginning of Vapor 2's maintenance phase have not yet been decided.

    +
    +

    Core

    +

    All packages in the Vapor GitHub are maintained according to the following rules.

    +

    Active

    +

    While a version is active, reported security issues and bugs are fixed.

    +

    Additionally, new features and optimizations may be added. If new API is added, the minor version number will be incremented. At no point can existing API be removed or broken during an active version. Semver is strictly followed and tested.

    +

    Maintenance

    +

    When a new version of Vapor is released, the previous version will enter a maintenance phase which lasts for six months. During this phase, critical security issues and bugs will be fixed. No new features will be added.

    +
    +

    Note

    +

    Only the latest minor version will be maintained.

    +
    +

    Unstable

    +

    The master branch is the latest development version of Vapor and is constantly changing. Before a new version of Vapor is released, there may be unstable alpha and beta phases in which you are welcome to test and provide feedback on the changes.

    +

    Community

    +

    All packages in the Vapor Community GitHub are maintained in strict accordance of semver. Violations of semver should be reported as issues to the offending package's GitHub page.

    + + +
    +
    +
    +
    + + + + +
    + + + + + + + + + + + + \ No newline at end of file