goji

command
v0.4.4-cloverhound-01 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

README

Example using Goji middleware

This example shows off using a combination of packages. Using the hnynethttp.WrapHandler around the main goji muxer gets you one basic event for every request that comes through, regardless of what handler it hits. Adding the middleware to goji with the Use function call gets additional fields that are custom to a matched goji pattern.

This example is runnable with go run main.go - it will start listening on port 8080.

Once it's running, in another window, issue a request to the /hello endpoint with a user's name as the variable: curl localhost:8080/hello/ben and you should an event appear on STDOUT in the pane running the example. The event printed will include the pattern matched (/hello/:name) as well as the contents of the name variable.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL