Skip to content

Commit

Permalink
Update README, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Kieltyka committed Aug 18, 2016
1 parent ac451e2 commit 1f2fb7e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## v2.0.0 (2016-07-26)
## v2.0.0rc1 (2016-07-26)

- Huge update! chi v2 is a large refactor targetting Go 1.7+. As of Go 1.7, the popular
community `"net/context"` package has been included in the standard library as `"context"` and
Expand Down
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@

[![GoDoc Widget]][GoDoc] [![Travis Widget]][Travis]

`chi` is a small, idiomatic and composable router for building Go 1.7+ HTTP services. `chi` utilizes
the new `context` package introduced in Go 1.7 to handle signaling, cancelation and request-scoped
values across a handler chain.

Chi encourages writing services by composing small handlers and middlewares constructed together
from multiple sub-routers that make up the complete service API.

In order to get the most out of this pattern, chi's routing methods (Get, Post, Handle, Mount, etc.)
support inline middlewares, middleware groups, and mounting (composing) any chi router to another.
We've designed the Pressly API (150+ routes/handlers) exactly like this for the goals of productivity,
maintainability and expression.
`chi` is a lightweight, idiomatic and composable router for building Go 1.7+ HTTP services. It's
especially good at helping you write large REST API services that are kept maintainable as your
project grows and changes. `chi` is built on the new `context` package introduced in Go 1.7 to
handle signaling, cancelation and request-scoped values across a handler chain.

The focus of the project has been to seek out an elegant and comfortable design for writing
REST API servers, written during the development of the Pressly API service that powers our
network of services.

The key considerations of chi's design were: project structure, maintainability, standard http
handlers (stdlib-only), developer productivity, and deconstructing a large system into many small
parts. The core router `github.com/pressly/chi` is quite small (less than 1000 LOC), but we've also
included some useful/optional subpackages: `middleware`, `render` and `docgen`. We hope it helps you too!

Looking ahead from the common REST convention for writing HTTP services, I also recommend newer works
in the field coming from gRPC, go-kit and graphql. They're all maturing nicely, each with their
own unique approaches and benefits.


## Features
Expand Down
2 changes: 1 addition & 1 deletion chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package chi

import "net/http"

// Chain returns a Middlewares slice.
// Chain returns a Middlewares type from a slice of middleware handlers.
func Chain(middlewares ...func(http.Handler) http.Handler) Middlewares {
return Middlewares(middlewares)
}
Expand Down
23 changes: 18 additions & 5 deletions docgen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,21 @@

## TODO

- [ ] Description - can we get description of each?
- [ ] sourcePath - hmm.. possible..? reflect..?
- [ ] endPoint - the function name..
- [ ] middleware - the function name
- [ ]
- [ ] Docgen: figure out projectPath, $GOPATH/src/XXX
- [ ] Docgen: parse comments from file line for handlers and middlewares
- [ ] Docgen: function name
- [ ] anonymous?
- [ ] name?
- [ ] package?
- [ ] Docgen: generate markdown from the JSON file ..
- [ ] Docgen: chi.Routes to not consider a chi.Router at all..?
- [ ] Docgen: for each handler/middleware:

"func": "ListHubs",
"pkg": "github.com/pressly/api/web/handlers/hubs"
"file": "github.com/pressly/api/web/handlers/hubs.go",
"line": "173"

- [ ] chi: method name for Chain() method? Inline()? something else?
- [ ] chi: Any() ?
- [ ] chi: Handle and HandleFunc ?

0 comments on commit 1f2fb7e

Please sign in to comment.