Mgserver is a Go library 📚 for create http server, it's inspired by GIN. You can use it as a GIN server.
Use the command to install mgserver.
go get github.com/milligoshant/mgserver
or
go get github.com/milligoshant/[email protected]
package main
import (
"log"
"github.com/milligoshant/mgserver"
)
func main() {
var port = ":8080"
// Initialize Gin router
r := mgserver.Default()
// Sample route
r.GET("/", func(c *mgserver.Context) {
c.JSON(200, mgserver.H{
"message": "Server is running",
})
})
r.Static("/static", "./static")
err := r.
WithETCD("MgserverTest2", "http://localhost:2379").
// for authenticate with username and password
// WithETCD("MgserverTest2", "localhost:2379", "root", "1234").
Run(port)
if err != nil {
log.Fatalf("Failed to start server: %v", err)
}
}
You can write us for contributing👏🏻.