{"id":18150067,"url":"https://github.com/sysulq/doggy","last_synced_at":"2025-04-07T12:08:50.525Z","repository":{"id":38206692,"uuid":"75715904","full_name":"sysulq/doggy","owner":"sysulq","description":"Lightweight, idiomatic and stable for building Go 1.7+ HTTP services","archived":false,"fork":false,"pushed_at":"2022-11-20T08:08:04.000Z","size":22752,"stargazers_count":281,"open_issues_count":5,"forks_count":64,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-03-31T10:11:10.012Z","etag":null,"topics":["doggy","golang","http","httprouter","mux","negroni","web-framework"],"latest_commit_sha":null,"homepage":"https://hnlq715.github.io/doggy/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sysulq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-06T09:28:41.000Z","updated_at":"2025-03-26T06:49:41.000Z","dependencies_parsed_at":"2023-01-23T09:30:13.833Z","dependency_job_id":null,"html_url":"https://github.com/sysulq/doggy","commit_stats":null,"previous_names":["sysulq/doggy","hnlq715/doggy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysulq%2Fdoggy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysulq%2Fdoggy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysulq%2Fdoggy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysulq%2Fdoggy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sysulq","download_url":"https://codeload.github.com/sysulq/doggy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247648978,"owners_count":20972945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["doggy","golang","http","httprouter","mux","negroni","web-framework"],"created_at":"2024-11-02T00:07:27.300Z","updated_at":"2025-04-07T12:08:50.502Z","avatar_url":"https://github.com/sysulq.png","language":"Go","readme":"Doggy\n===\n[![Build Status](https://travis-ci.org/hnlq715/doggy.svg?branch=master)](https://travis-ci.org/hnlq715/doggy)\n[![Go Report Card](https://goreportcard.com/badge/github.com/hnlq715/doggy)](https://goreportcard.com/report/github.com/hnlq715/doggy)\n\nLightweight, idiomatic and stable for building Go 1.7+ HTTP services.\nIt aims to provide a composable way to develop HTTP services.\n\ndependency\n---\n\n* [uber-go/zap](github.com/uber-go/zap)\n* [gorilla/mux](github.com/gorilla/mux)\n* [gorilla/schema](github.com/gorilla/schema)\n* [urfave/negroni](github.com/urfave/negroni)\n* [juju/ratelimit](github.com/juju/ratelimit)\n* [unrolled/render](github.com/unrolled/render)\n* [asaskevich/govalidator.v4](gopkg.in/asaskevich/govalidator.v4)\n* [julienschmidt/httprouter](github.com/julienschmidt/httprouter)\n\nGenerate api struct\n---\n* [himeraCoder/gojson](https://github.com/ChimeraCoder/gojson)\n```\ncurl -s https://api.github.com/repos/chimeracoder/gojson | gojson -name=Repository -tags=schema,json\n```\n\nGenerate model package\n---\n* [hnlq715/xo](https://github.com/hnlq715/xo)\n```\nxo mysql://user:passwd@host:port/db -o . --template-path templates --ignore-fields updateTime\n```\n\nExample\n---\n```\npackage main\n\nimport (\n\t\"net/http\"\n\t\"net/url\"\n\t\"time\"\n\n\t\"github.com/hnlq715/doggy\"\n\t\"github.com/hnlq715/doggy/httpclient\"\n\t\"github.com/hnlq715/doggy/middleware\"\n\t\"github.com/hnlq715/doggy/render\"\n\t\"github.com/prometheus/client_golang/prometheus/promhttp\"\n)\n\nfunc main() {\n\n\tm := doggy.NewMux()\n\n\tm.Handle(\"/metrics\", promhttp.Handler())\n\tm.HandleFunc(\"/ping\", func(w http.ResponseWriter, r *http.Request) {\n\t\tprocessTime := 4 * time.Second\n\t\tctx := r.Context()\n\t\tselect {\n\t\tcase \u003c-ctx.Done():\n\t\t\treturn\n\t\tcase \u003c-time.After(processTime):\n\t\t}\n\t\trender.Text(w, 200, \"pong\")\n\t})\n\n\tm.HandleFunc(\"/get\", func(w http.ResponseWriter, r *http.Request) {\n\t\tdata := make(map[string]interface{})\n\t\tu, _ := url.Parse(\"http://httpbin.org/get\")\n\t\tu.RawQuery = r.Form.Encode()\n\t\terr := httpclient.Get(r.Context(), u.String()).ToJSON(\u0026data)\n\t\tif err != nil {\n\t\t\trender.Text(w, 200, err.Error())\n\t\t\treturn\n\t\t}\n\t\trender.JSON(w, 200, data)\n\t})\n\n\tn := doggy.Classic()\n\tn.Use(middleware.NewPrometheus())\n\tn.UseHandler(m)\n\n\tdoggy.ListenAndServeGracefully(n)\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysulq%2Fdoggy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsysulq%2Fdoggy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysulq%2Fdoggy/lists"}