Releases: go-humble/router
Version 0.5.0
This version includes an improvement to the regex used for route pattern matching and support for query parameters.
This version is backwards compatible with version 0.4.0.
Big thanks to @jancona for contributing!
Changelog
- Improved regex for route pattern matching to support various special characters.
- Added support for query parameters. They are accessible from within rout handlers via
Context.QueryParameters
.
Version 0.4.0
This version includes small bug fixes and minor new features.
Changelog
- Fixed a bug where
InterceptLinks
was not working in some cases when multiple links were present on the page. (Thanks @boyvinall!) - Removed a call to
log.Fatal
if a path did not match any known routes. This was causing Karma tests to fail and may have been causing some issues in real world usage. - Added a new
Verbose
option, which if set totrue
will cause a router to log whenever a path does not match any known routes. This can be viewed as a replacement for the oldlog.Fatal
behavior. - Updated guidelines in CONTRIBUTING.md to make contributing easier.
Version 0.2.2
This release simply fixes some typos in the README.
Version 0.2.0
This release fixes one minor bug and makes handler functions more flexible.
In previous releases, router.Handler
was a function that accepted a map[string]string
as an argument. Version 0.2.0 changes that, instead using router.Context
as an argument, which is defined as follows:
// Context is used as an argument to Handlers
type Context struct {
// Params is the parameters from the url as a map of names to values.
Params map[string]string
// Path is the path that triggered this particular route. If the hash
// fallback is being used, the value of path does not include the '#'
// symbol.
Path string
// InitialLoad is true iff this route was triggered during the initial
// page load. I.e. it is true if this is the first path that the browser
// was visiting when the javascript finished loading.
InitialLoad bool
}
In addition, this release fixes a minor bug. In previous releases, a router behaved differently depending on whether or not history.pushState was supported. If the router was using the hash fallback, it would trigger a route during the initial page load. However, if the pushState implementation was being used, it would not do so. Version 0.2.0 unifies the two implementations, and now they will both trigger the appropriate route on initial page load. We have also included Context.InitialLoad
, which is a boolean indicating whether or not the route was triggered on initial page load.
Full Changelog
- Handlers now take
Context
as an argument instead of a map of parameters. - If pushState is supported, router will trigger the appropriate route on the initial page load.
Version 0.1.0
This is the initial release following the migration from github.com/soroushjp to github.com/go-humble and the split into stand-alone packages.
See the README for a list of features, a getting started guide, and more information.