MyGit

godzillaframework/godzilla

Fork: 4 Star: 24 (更新于 1970-01-01 00:00:00)

license: Apache-2.0

Language: Go .

A Powerful Go Full-Stack Web Framework Built For Devs

最后发布版本: v2 ( 2021-12-08 22:18:33)

官方网址 GitHub网址

godzilla

forthebadge

About:

  • A powerfull go web framework
  • Fast 🚀
  • Secure 🔒
  • Easy Peasy :)

Features:

  • Log Middleware

Installation:

go get -u github.com/godzillaframework/godzilla

Examples:

  • a simple api
package main

import "github.com/godzillaframework/godzilla"

func main() {
	gz := godzilla.New()

	gz.Get("/index", func(ctx godzilla.Context) {
		ctx.SendString("Hello EveryOne!!!")
	})

	gz.Start(":9090")
}
  • params
package main

import "github.com/godzillaframework/godzilla"

func main() {
    gz := godzilla.New()

    gz.Get("/users/:user", func(ctx godzilla.Context) {
        ctx.SendString(ctx.Param("user"))
    })

    gz.Start(":8080")
}
  • static files
package main

import "github.com/godzillaframework/godzilla"

func main() {
    gz := godzilla.New()

    gz.Static("/imgs", "./images")

    /* go to localhost:8080/imgs/image.png */

    gz.Start(":8080")
}

middleware:

  • Log middleware:
package main

import (
	"log"

	"github.com/godzillaframework/godzilla"
)

func main() {
	gz := godzilla.New()
	
	logMiddleware := func(ctx godzilla.Context) {
		log.Printf("log message!")

		ctx.Next()
	}
	
	gz.Use(logMiddleware)
	
	gz.Start(":8080")
  • Unauthorized middleware:
package main

import (
	"log"

	"github.com/godzillaframework/godzilla"
)

func main() {

	gz := godzilla.New()

	unAuthorizedMiddleware := func(ctx godzilla.Context) {
		ctx.Status(godzilla.StatusUnauthorized).SendString("You are unauthorized to access this page!")
	}

	gz.Get("/hello", func(ctx godzilla.Context) {
		ctx.SendString("Hello World!")
	})

	gz.Get("/protected", unAuthorizedMiddleware, func(ctx godzilla.Context) {
		ctx.SendString("You accessed a protected page")
	})


	gz.Start(":8080")
}

  • example app

  • for more tutorials visit the docs

最近版本更新:(数据更新于 1970-01-01 00:00:00)

2021-12-08 22:18:33 v2

2021-11-17 15:23:00 v1

主题(topics):

framework, go, go-framework, go-library, go-web-framework, goapi, godzilla, golang, linux, macos, microservics, middleware, restapi, router, unix, web, webframework, windows

godzillaframework/godzilla同语言 Go最近更新仓库

2024-11-21 22:49:20 containerd/containerd

2024-11-21 13:50:50 XTLS/Xray-core

2024-11-21 07:36:18 kubernetes/kubernetes

2024-11-21 06:27:30 ollama/ollama

2024-11-21 05:17:55 Melkeydev/go-blueprint

2024-11-21 04:04:03 dolthub/dolt