Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 551 Bytes

File metadata and controls

34 lines (25 loc) · 551 Bytes

Install

go get -u github.com/gota33/initializr

Example

package main

import (
	"log"

	"github.com/gofiber/fiber/v2"
	"github.com/gota33/initializr"
	fiber2 "github.com/gota33/initializr/fiber/v2"
)

func main() {
	ctx, cancel := initializr.GracefulContext()
	defer cancel()

	server, listen, shutdown := fiber2.New(":8080")

	server.Get("hello", func(c *fiber.Ctx) error {
		return c.SendString("Hello")
	})

	if err := initializr.Run(ctx, listen, shutdown); err != nil {
		log.Fatalf("Exit with error: %v", err)
	}
}