All Projects → hnlq715 → Doggy

hnlq715 / Doggy

Licence: mit
Lightweight, idiomatic and stable for building Go 1.7+ HTTP services

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Doggy

flute
The Application Framework Built for Powerful, Secure features and add-ons
Stars: ✭ 14 (-94.78%)
Mutual labels:  web-framework
mux-python
Official Mux API wrapper for python projects, supporting both Mux Data and Mux Video.
Stars: ✭ 34 (-87.31%)
Mutual labels:  mux
fano
Pascal web application framework
Stars: ✭ 21 (-92.16%)
Mutual labels:  web-framework
geronimo-config
Apache Geronimo Config
Stars: ✭ 15 (-94.4%)
Mutual labels:  web-framework
mux-go
Official Mux API wrapper for golang projects, supporting both Mux Data and Mux Video.
Stars: ✭ 69 (-74.25%)
Mutual labels:  mux
w4py
Webware for Python
Stars: ✭ 21 (-92.16%)
Mutual labels:  web-framework
maverick
Web API framework with a need for speed
Stars: ✭ 14 (-94.78%)
Mutual labels:  web-framework
Jupiter
Jupiter是斗鱼开源的面向服务治理的Golang微服务框架
Stars: ✭ 3,455 (+1189.18%)
Mutual labels:  web-framework
Navigation
一款基于 Workerman 的 PHP Web 开发框架。
Stars: ✭ 20 (-92.54%)
Mutual labels:  web-framework
mangooio
An Intuitive, Lightweight, High Performance Full Stack Java Web Framework.
Stars: ✭ 52 (-80.6%)
Mutual labels:  web-framework
Bukdu.jl
Bukdu 🌌 is a web development framework for Julia
Stars: ✭ 125 (-53.36%)
Mutual labels:  web-framework
go-mux-jwt-boilerplate
Golang REST API using MUX, GORM, and JWT for authentication
Stars: ✭ 41 (-84.7%)
Mutual labels:  mux
kotlin-dropwizard
Getting Started with Dropwizard and Kotlin
Stars: ✭ 43 (-83.96%)
Mutual labels:  web-framework
shivneri
Component based MVC web framework based on fort architecture targeting good code structures, modularity & performance.
Stars: ✭ 21 (-92.16%)
Mutual labels:  web-framework
tinyhttp
🦕 Deno port of tinyhttp, 0-legacy, tiny & fast web framework
Stars: ✭ 84 (-68.66%)
Mutual labels:  web-framework
nardis
A small web framework based on ASGI
Stars: ✭ 14 (-94.78%)
Mutual labels:  web-framework
flaskage
Flaskage is a complete and carefully designed template for use with the Flask web framework.
Stars: ✭ 36 (-86.57%)
Mutual labels:  web-framework
Sihl
A modular functional web framework
Stars: ✭ 267 (-0.37%)
Mutual labels:  web-framework
Hunt Framework
A Web framework for D Programming Language. Full-stack high-performance.
Stars: ✭ 256 (-4.48%)
Mutual labels:  web-framework
rexsl
Java RESTful XSL-based Web Framework
Stars: ✭ 16 (-94.03%)
Mutual labels:  web-framework

Doggy

Build Status Go Report Card

Lightweight, idiomatic and stable for building Go 1.7+ HTTP services. It aims to provide a composable way to develop HTTP services.

dependency

Generate api struct

curl -s https://api.github.com/repos/chimeracoder/gojson | gojson -name=Repository -tags=schema,json

Generate model package

xo mysql://user:[email protected]:port/db -o . --template-path templates --ignore-fields updateTime

Example

package main

import (
	"net/http"
	"net/url"
	"time"

	"github.com/hnlq715/doggy"
	"github.com/hnlq715/doggy/httpclient"
	"github.com/hnlq715/doggy/middleware"
	"github.com/hnlq715/doggy/render"
	"github.com/prometheus/client_golang/prometheus/promhttp"
)

func main() {

	m := doggy.NewMux()

	m.Handle("/metrics", promhttp.Handler())
	m.HandleFunc("/ping", func(w http.ResponseWriter, r *http.Request) {
		processTime := 4 * time.Second
		ctx := r.Context()
		select {
		case <-ctx.Done():
			return
		case <-time.After(processTime):
		}
		render.Text(w, 200, "pong")
	})

	m.HandleFunc("/get", func(w http.ResponseWriter, r *http.Request) {
		data := make(map[string]interface{})
		u, _ := url.Parse("http://httpbin.org/get")
		u.RawQuery = r.Form.Encode()
		err := httpclient.Get(r.Context(), u.String()).ToJSON(&data)
		if err != nil {
			render.Text(w, 200, err.Error())
			return
		}
		render.JSON(w, 200, data)
	})

	n := doggy.Classic()
	n.Use(middleware.NewPrometheus())
	n.UseHandler(m)

	doggy.ListenAndServeGracefully(n)
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].