Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Casperhr authored Jan 4, 2017
1 parent d70392c commit 2849e3c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ Update your `Package.swift` file.
```

### main.swift
```
```swift
import Flash
```

And add middleware either global
```
```swift
drop.middleware.append(FlashMiddleware())
```

or just to your route group

```
```swift
drop.group(FlashMiddleware()) { group in
// Routes
}
Expand All @@ -36,7 +36,7 @@ drop.group(FlashMiddleware()) { group in
### Usages

Apply flash on a response, which will be shown on next request
```
```swift
return Response(redirect: "/admin/users").flash(.error, "Failed to save user")
return Response(redirect: "/admin/users").flash(.success, "Successfuly saved")
return Response(redirect: "/admin/users").flash(.warning, "Updated user")
Expand All @@ -45,7 +45,7 @@ return Response(redirect: "/admin/users").flash(.info, "Email sent")

### Misc functions

```
```swift
// Add to request by string
try request.flash.add(custom: String, message: String)

Expand All @@ -61,7 +61,7 @@ try request.flash.refresh()
```

### Example of HTML
```
```html
<!--Error-->
#if(request.storage._flash.error) {
<div class="alert alert-danger alert-dismissible fade in to-be-animated-in" role="alert">
Expand Down

0 comments on commit 2849e3c

Please sign in to comment.