Skip to content

MilliGoshant/mgserver

Repository files navigation

⌨️ mgserver

Mgserver is a Go library 📚 for create http server, it's inspired by GIN. You can use it as a GIN server.

Installation

Use the command to install mgserver.

go get github.com/milligoshant/mgserver

or

go get github.com/milligoshant/[email protected]

Usage

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

Contributing

You can write us for contributing👏🏻.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published