Skip to content

Commit

Permalink
Merge pull request #1 from ngdinhtoan/master
Browse files Browse the repository at this point in the history
- Update README doc.
- Add missing flag.Parse() for swgui-server.
  • Loading branch information
ngdinhtoan authored Apr 21, 2017
2 parents 875886a + 6ef5f7a commit 0882892
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
30 changes: 14 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
# Swagger UI

Package swgui (Swagger UI) provide a HTTP handler to serve Swagger UI.
[![GoDoc](https://godoc.org/github.com/lazada/swgui?status.svg)](https://godoc.org/github.com/lazada/swgui)

Package `swgui` (Swagger UI) provide a HTTP handler to serve Swagger UI.
All assets are embedded in GO source code, so just build and run.

## How to use

```go
package main
package main

import "http"
import "github.com/lazada/swgui"
import (
"http"

func main() {
http.Handle("/", swgui.NewHandler("Page title", "path/to/swagger.json", "/"))
http.ListenAndServe(":8080", nil)
}
"github.com/lazada/swgui"
)

func main() {
http.Handle("/", swgui.NewHandler("Page title", "path/to/swagger.json", "/"))
http.ListenAndServe(":8080", nil)
}
```

## Run as standalone server

Install swgui server
Install `swgui-server`

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

Start server

swgui-server -port 8080

## GoDoc

[![GoDoc](https://godoc.org/github.com/lazada/swgui?status.svg)](https://godoc.org/github.com/lazada/swgui)

godoc github.com/lazada/swgui/

4 changes: 3 additions & 1 deletion swgui-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ func init() {
flag.StringVar(&host, "host", "", "Host")
flag.UintVar(&port, "port", 8080, "Port")
flag.StringVar(&title, "title", "API Document", "Page title")

flag.Parse()
}

func main() {
http.Handle("/", swgui.NewHandler(title, "", "/"))
http.Handle("/", swgui.NewHandler(title, "/swagger.json", "/"))
http.ListenAndServe(fmt.Sprintf("%s:%d", host, port), nil)
}

0 comments on commit 0882892

Please sign in to comment.