API docs
This commit is contained in:
12
api/api.go
12
api/api.go
@@ -2,13 +2,17 @@ package api
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
"github.com/go-chi/docgen"
|
||||
"github.com/go-chi/render"
|
||||
)
|
||||
|
||||
var routes = flag.Bool("routes", false, "Generate API route documentation")
|
||||
|
||||
func Start() {
|
||||
flag.Parse()
|
||||
|
||||
@@ -40,5 +44,13 @@ func Start() {
|
||||
})
|
||||
})
|
||||
|
||||
if *routes {
|
||||
fmt.Println(docgen.MarkdownRoutesDoc(r, docgen.MarkdownOpts{
|
||||
ProjectPath: "git.dubyatp.xyz/chat-api-server",
|
||||
Intro: "Welcome to the chat API server. This is a simple API for sending and receiving messages.",
|
||||
}))
|
||||
return
|
||||
}
|
||||
|
||||
http.ListenAndServe(":3000", r)
|
||||
}
|
||||
|
Reference in New Issue
Block a user