Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use other garson router instances with Router.Use() #5

Open
ishehata opened this issue Sep 10, 2016 · 0 comments
Open

use other garson router instances with Router.Use() #5

ishehata opened this issue Sep 10, 2016 · 0 comments
Assignees

Comments

@ishehata
Copy link
Collaborator

ishehata commented Sep 10, 2016

current behaviour:
we can only use one router instance in the main func of our application

expected behaviour:
what if we need to split our router into to multiple files (multiple apps inside one project).
thats where we need to make a method called Use() on the Router struct, so that it takes in another router instance.

example

some_module.go

Router = garson.New()
Router.Get('/example', some_handler)
import (
    "garson"
    "some_module"
)

func main() {
    r = garson.Router()
    r.Use(some_module.Router)

}
@ishehata ishehata self-assigned this Sep 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant