Merge pull request #286 from jonny7/patch-2

LeafRenderer has no member make()
This commit is contained in:
Tim 2018-02-21 13:53:28 +00:00 committed by GitHub
commit 3a1559b2c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -13,13 +13,19 @@ Welcome to Leaf. Leaf's goal is to be a simple templating language that can make
Once you have Leaf installed, you should create a directory called “Resources” inside your project folder, and inside that create another directory called “Views”. This Resources/Views directory is the default location for Leaf templates, although you can change it if you want.
To render a basic Leaf template from a route, add this code:
Firstly, import Leaf to routes.swift
```swift
import Leaf
```
Then, to render a basic Leaf template from a route, add this code:
```swift
router.get { req -> Future<View> in
let leaf = try req.make(LeafRenderer.self)
let context = [String: String]()
return try leaf.make("home", context)
return try leaf.render("home", context)
}
```