Fixes to recent extension changes. (#568)

* Fixes to recent extension changes.

* Fixes issue where gin will continue calling the handler even if next() isn't called.

* Updated docs.
This commit is contained in:
Travis Reeder
2017-12-06 10:12:55 -08:00
committed by GitHub
parent 3096900d52
commit 6b8627d1c5
6 changed files with 52 additions and 22 deletions

View File

@@ -1,3 +0,0 @@
# Docs for Contributors
* [Writing Extensions](extending.md)

View File

@@ -20,17 +20,19 @@ to be called during setup:
```go
func init() {
server.RegisterExtension(&fnext.Extension{
Name: "logspam",
Name: "github.com/treeder/fn-ext-example/logspam", // Should be the import name
Setup: setup, // Fn will call this during startup
})
}
func setup(s *fnext.ExtServer) error {
// Add all the hooks you extension needs here
// Add all the hooks your extension needs here
s.AddCallListener(&LogSpam{})
}
```
See https://github.com/treeder/fn-ext-example for full example.
## Listeners
Listeners are the main way to extend Fn.