github vapor/vapor 1.1.0
Vapor 1.1

latest releases: 4.100.0, 4.99.3, 4.99.2...
7 years ago

New:

  • Programmatically configure servers
  • clients.json for TLS configuration
  • request.lang to access Accept-Language

Better:

  • Simplified Droplet configuration
    • drop.addProvider
    • drop.addConfigurable
  • Expanded drop.view.make context support.
  • More flexible Provider API
    • boot(_ drop: Droplet)
  • 500 errors are logged in production mode.

Fixed:

  • TLS server crashes

Migration guide

Vapor projects running 1.0 will continue to compile with 1.1, but you may see new deprecation warnings. Here's how to update your code:

Droplet Config

In 1.1, almost all properties on the Droplet are variable. This makes configuring the Droplet a lot easier and removes dependence on large init calls.

let drop = Droplet(
    console: myConsole, 
    availableMiddleware: ["my-middleware": myMiddleware], 
    providers: [MyProvider.self],
    preparations: [MyPreparation.self]
)

The Droplet can now be configured manually

let drop = Droplet()

try drop.addProvider(MyProvider.self)

drop.console = myConsole
drop.middleware.append(myMiddleware)
drop.preparations.append(MyPreparations.self)

Or with configuration in mind.

let drop = Droplet()

try drop.addProvider(MyProvider.self)

drop.addConfigurable(console: myConsole, name: "my-console")
drop.addConfigurable(middleware: myMiddleware, name: "my-middleware")

drop.preparations.append(MyPreparations.self)

Read more about these updates in the Droplet section of the docs.

Additionally, take a look at the updated basic-template

Especially the pull request converting the basic-template from 1.0, to 1.1.

Don't miss a new vapor release

NewReleases is sending notifications on new releases.