Categorygithub.com/olivetree123/coco
modulepackage
0.0.0-20200403021225-7a48d6d3a296
Repository: https://github.com/olivetree123/coco.git
Documentation: pkg.go.dev

# README

Coco

Build Status codecov Codacy Badge GitHub
Coco is an http web framework for golang.

Install

go get -u github.com/olivetree123/coco

Tutorial

import (
    "github.com/olivetree123/coco"
)

func HelloHandler(c *coco.Coco) coco.Result {
    return coco.APIResponse("Hello Coco !")
}

func main() {
    c := coco.NewCoco()
    c.AddRouter("GET", "/", HelloHandler)
    c.Run()
}

Params

// GET, /api?name=123
params := c.Request.URL.Query()
params.Get("name")

// GET, param in url, /api/:name
name := c.Params.ByName("name")

// POST JSON
var param DBCreateParam
decoder := json.NewDecoder(c.Request.Body)
err := decoder.Decode(&param)

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

Coco Framework.
Result 返回结果.

# Type aliases

Handler 所有 handler 都会被转换成该类型.