refactor: Go Baseline

This commit is contained in:
2024-12-02 16:53:32 +01:00
parent f9b471b59e
commit aeeb7b3448
5 changed files with 94 additions and 0 deletions

35
main.go Normal file
View File

@@ -0,0 +1,35 @@
package main
import (
"flag"
"log"
"git.odit.services/lfk/document-server/handlers"
"github.com/gofiber/fiber/v2"
)
var (
port = flag.String("port", ":3000", "Port to listen on")
prod = flag.Bool("prod", false, "Enable prefork in Production")
)
func main() {
// Parse command-line flags
flag.Parse()
// Create a new Fiber instance
app := fiber.New(fiber.Config{
Prefork: *prod,
})
v1 := app.Group("/v1")
v1.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Hello, World!")
})
v1.Post("/contracts", handlers.GenerateContract)
app.Use(handlers.NotFoundHandler)
log.Fatal(app.Listen(*port))
}