Giter Site home page Giter Site logo

gzong's Introduction

gzong

Sourcegraph GoDoc Go Report Card Build Status Codecov License

Installation

一个以Go为基础的简单web框架,支持中间件插入,已有3个简单的中间件可集成(basicAuth、logging、session),部分完成单元测试。

demo中简单实现了支持增删查改的用户中心(docker+MongoDB)仅供参考。

Usage

试着写一个hello world,可参照gzong/example/easy.go

package main

import (
	"fmt"
	"github.com/cshwen/gzong"
	"net/http"
)

func main() {
	gz := gzong.New()
	gz.GET("/test", testFunc)
	gz.Run(":8080")
}

func testFunc(w http.ResponseWriter, _ *http.Request) {
	fmt.Fprintln(w, "hello gzong.")
}

然后写完记得先编译下(go build)再启动服务(go run)

# 编译
$ go build
# 启动服务
$ go run gzong/example/easy.go
# 测试服务
$ curl localhost:8080/test

Ps: 还有个已实现好的比较复杂示例gzong/example/complex/complex.go可参照上述流程实操试验下。

TODO

  1. 基础web服务,可启动可正常访问 ✔️

  2. 服务框架化 ✔️

  3. 路由支持 ✔️

  4. 中间件支持 ✔️

  5. logging支持 ✔️

  6. basicAuth支持 ✔️

  7. session支持 ✔️

  8. demo实现 ✔️

  9. MongoDB环境(docker) ✔️

  10. MongoDB CRUD实现(用户中心) ✔️

  11. 测试 ✔️

  12. 文档 ✔️

  13. 汇总 ✔️

gzong's People

Contributors

cshwen avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.