Skip to content

Commit ea7a860

Browse files
authored
Merge pull request #115 from bmf-san/feature/use-export-test-pkg
Use export test pkg
2 parents 4c1ce5b + 0ee8fb4 commit ea7a860

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

README-ja.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
- [デフォルトOPTIONSハンドラー](#デフォルトoptionsハンドラー)
3232
- [ベンチマークテスト](#ベンチマークテスト)
3333
- [設計](#設計)
34+
- [Wiki](#wiki)
3435
- [コントリビューション](#コントリビューション)
3536
- [スポンサー](#スポンサー)
3637
- [ライセンス](#ライセンス)
@@ -64,7 +65,7 @@ go get -u github.com/bmf-san/goblin
6465
#
6566
サンプルの実装を用意しています。
6667

67-
[_examples](https://github.com/bmf-san/goblin/blob/master/_examples)をご参照ください。
68+
[example_goblin_test.go](https://github.com/bmf-san/goblin/blob/master/example_goblin_test.go)をご参照ください。
6869

6970
# 使い方
7071
## メソッドベースのルーティング
@@ -335,6 +336,9 @@ HTTPメソッドごとに木を構築するようになっています。
335336

336337
改善のアイデアがあればぜひ教えてください!
337338

339+
# Wiki
340+
参考資料の一覧は[wiki](https://github.com/bmf-san/goblin/wiki)に記載しています。
341+
338342
# コントリビューション
339343
IssueやPull Requestはいつでもお待ちしています。
340344

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ This logo was created by [gopherize.me](https://gopherize.me/gopher/d654ddf2b81c
3131
- [Default OPTIONS handler](#default-options-handler)
3232
- [Benchmark tests](#benchmark-tests)
3333
- [Design](#design)
34+
- [Wiki](#wiki)
3435
- [Contribution](#contribution)
3536
- [Sponsor](#sponsor)
3637
- [Stargazers](#stargazers)
@@ -66,7 +67,7 @@ go get -u github.com/bmf-san/goblin
6667
# Example
6768
A sample implementation is available.
6869

69-
Please refer to [_examples](https://github.com/bmf-san/goblin/blob/master/_examples).
70+
Please refer to [example_goblin_test.go](https://github.com/bmf-san/goblin/blob/master/example_goblin_test.go).
7071

7172
# Usage
7273
## Method based routing
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
package main
1+
package goblin_test
22

33
import (
4+
"log"
45
"net/http"
56

6-
goblin "github.com/bmf-san/goblin"
7+
"github.com/bmf-san/goblin"
78
)
89

910
func CORS(next http.Handler) http.Handler {
@@ -34,7 +35,7 @@ func BazHandler() http.Handler {
3435
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})
3536
}
3637

37-
func main() {
38+
func ExampleListenAndServe() {
3839
r := goblin.NewRouter()
3940

4041
r.Methods(http.MethodGet).Handler(`/`, RootHandler())
@@ -44,5 +45,7 @@ func main() {
4445
r.Methods(http.MethodPost).Use(CORS).Handler(`/foo/:name`, FooNameHandler())
4546
r.Methods(http.MethodGet).Handler(`/baz`, BazHandler())
4647

47-
http.ListenAndServe(":9999", r)
48+
if err := http.ListenAndServe(":9999", r); err != nil {
49+
log.Fatal(err)
50+
}
4851
}

0 commit comments

Comments
 (0)