Update README.md

This commit is contained in:
Kyle Jessup 2018-04-12 11:42:14 -04:00 committed by GitHub
parent 11fb6a1676
commit 94123e4974
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -51,6 +51,14 @@ To start, add this project as a dependency in your Package.swift file.
.Package(url: "https://github.com/PerfectlySoft/Perfect-Mustache.git", majorVersion: 3) .Package(url: "https://github.com/PerfectlySoft/Perfect-Mustache.git", majorVersion: 3)
``` ```
Basic usage:
```swift
let map: [String:Any] = ["fullName":fullName, "uri":uri, "authToken":authToken]
let ctx = MustacheEvaluationContext(templatePath: emailTemplate, map: map)
let result = try ctx.formulateResponse(withCollector: MustacheEvaluationOutputCollector())
```
The following snippet illustrates how to use mustache templates in your URL handler. In this example, the template named "test.html" would be located in your server's web root directory. The following snippet illustrates how to use mustache templates in your URL handler. In this example, the template named "test.html" would be located in your server's web root directory.
```swift ```swift