Skip to content

Commit

Permalink
Add ExpressInterface to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
DronRathore committed Jul 9, 2017
1 parent 324ebb1 commit 85c16f2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ func main (){
app.Start("8080")
}
```
## ExpressInterface
You can pass around the instance of ```express``` struct across packages using this interface.
```go
func main(){
var app = express.Express()
attachHandlers(app)
}
func attachHandlers(instance express.ExpressInterface){
instance.Use(someMiddleware)
instance.Set("logging", true)
}
```
## Cookies
```go
import (
Expand Down
2 changes: 2 additions & 0 deletions express.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ type express struct {
started bool
properties map[string]interface{}
}

// Public Interface to allow access to express struct's member functions
type ExpressInterface interface {
Use(interface{}) *express
Get(string, router.Middleware) *express
Expand Down

0 comments on commit 85c16f2

Please sign in to comment.