Skip to content

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

Description

@ishehata

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)

}

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions