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-05 08:55:31 XTLS/Xray-core

2024-11-05 00:03:47 SagerNet/sing-box

2024-11-04 20:34:19 Permify/permify

2024-11-04 15:07:27 containerd/containerd

2024-11-03 20:10:56 flipped-aurora/gin-vue-admin

2024-11-03 00:46:25 dolthub/dolt