This commit is contained in:
2024-12-29 23:29:33 -05:00
parent c2df6028b3
commit cad40565b0
11 changed files with 689 additions and 0 deletions

View File

@@ -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)
}