-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathmain.go
41 lines (32 loc) · 810 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
This file is intended solely for testing the OpenAPI Spec Browser, allowing
developers to explore the OpenAPI specification without the need to build and
start the chain.
To start the server, run `go run docs/main.go` and navigate to
http://localhost:8080 in your browser.
*/
package main
import (
"log"
"net/http"
"time"
"github.com/gorilla/mux"
"github.com/zeta-chain/zetacore/docs/openapi"
)
func main() {
router := mux.NewRouter()
openapi.RegisterOpenAPIService(router)
http.Handle("/", router)
server := &http.Server{
Addr: ":8080",
Handler: router,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 30 * time.Second,
}
log.Println("Starting server on :8080")
err := server.ListenAndServe()
if err != nil {
log.Fatal(err)
}
}