Skip to content

Commit 0882892

Browse files
authored
Merge pull request #1 from ngdinhtoan/master
- Update README doc. - Add missing flag.Parse() for swgui-server.
2 parents 875886a + 6ef5f7a commit 0882892

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

README.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
# Swagger UI
22

3-
Package swgui (Swagger UI) provide a HTTP handler to serve Swagger UI.
3+
[![GoDoc](https://godoc.org/github.com/lazada/swgui?status.svg)](https://godoc.org/github.com/lazada/swgui)
4+
5+
Package `swgui` (Swagger UI) provide a HTTP handler to serve Swagger UI.
46
All assets are embedded in GO source code, so just build and run.
57

68
## How to use
79

810
```go
9-
package main
11+
package main
1012

11-
import "http"
12-
import "github.com/lazada/swgui"
13+
import (
14+
"http"
1315

14-
func main() {
15-
http.Handle("/", swgui.NewHandler("Page title", "path/to/swagger.json", "/"))
16-
http.ListenAndServe(":8080", nil)
17-
}
16+
"github.com/lazada/swgui"
17+
)
18+
19+
func main() {
20+
http.Handle("/", swgui.NewHandler("Page title", "path/to/swagger.json", "/"))
21+
http.ListenAndServe(":8080", nil)
22+
}
1823
```
1924

2025
## Run as standalone server
2126

22-
Install swgui server
27+
Install `swgui-server`
2328

2429
go get github.com/lazada/swgui/...
2530

2631
Start server
2732

2833
swgui-server -port 8080
29-
30-
## GoDoc
31-
32-
[![GoDoc](https://godoc.org/github.com/lazada/swgui?status.svg)](https://godoc.org/github.com/lazada/swgui)
33-
34-
godoc github.com/lazada/swgui/
35-

swgui-server/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ func init() {
1818
flag.StringVar(&host, "host", "", "Host")
1919
flag.UintVar(&port, "port", 8080, "Port")
2020
flag.StringVar(&title, "title", "API Document", "Page title")
21+
22+
flag.Parse()
2123
}
2224

2325
func main() {
24-
http.Handle("/", swgui.NewHandler(title, "", "/"))
26+
http.Handle("/", swgui.NewHandler(title, "/swagger.json", "/"))
2527
http.ListenAndServe(fmt.Sprintf("%s:%d", host, port), nil)
2628
}

0 commit comments

Comments
 (0)