{"id":20459748,"url":"https://github.com/rosbit/mgin","last_synced_at":"2026-04-19T11:34:26.474Z","repository":{"id":57629170,"uuid":"405878350","full_name":"rosbit/mgin","owner":"rosbit","description":"a lightweight web server framework like gin. 轻量级http服务框架","archived":false,"fork":false,"pushed_at":"2025-07-22T02:22:54.000Z","size":40,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-22T04:24:02.533Z","etag":null,"topics":["framework","golang","http-server","web-server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rosbit.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-09-13T07:40:11.000Z","updated_at":"2025-07-22T02:22:45.000Z","dependencies_parsed_at":"2024-04-05T03:24:52.043Z","dependency_job_id":"988997d7-665a-4859-9b5d-696b462e2bd8","html_url":"https://github.com/rosbit/mgin","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/rosbit/mgin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosbit%2Fmgin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosbit%2Fmgin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosbit%2Fmgin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosbit%2Fmgin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rosbit","download_url":"https://codeload.github.com/rosbit/mgin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosbit%2Fmgin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32005814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["framework","golang","http-server","web-server"],"created_at":"2024-11-15T12:17:09.271Z","updated_at":"2026-04-19T11:34:26.454Z","avatar_url":"https://github.com/rosbit.png","language":"Go","readme":"# mgin\n\nA http framework to support router and argument processing\n\n## Sample #1: handler with http.HandlerFunc\n\n```go\npackage main\n\nimport (\n    \"github.com/rosbit/mgin\"\n    \"net/http\"\n    \"fmt\"\n)\n\nfunc main() {\n    r := mgin.NewMgin()\n\n    r.Get(\"/hello\", func(w http.ResponseWriter, r *http.Request) {\n        c := mgin.NewHttpContext(w, r)\n        c.String(http.StatusOK, \"hello\")\n    })\n\n    r.Get(\"/json/:msg\", func(w http.ResponseWriter, r *http.Request) {\n        c := mgin.NewHttpContext(w, r)\n        msg := c.Param(\"msg\")\n        c.JSON(http.StatusOK, map[string]interface{} {\n            \"code\": http.StatusOK,\n            \"msg\": msg,\n        })\n    })\n\n    r.Post(\"/json\", func(w http.ResponseWriter, r *http.Request) {\n        c := mgin.NewHttpContext(w, r)\n        var i interface{}\n        code, err := c.ReadJSON(\u0026i)\n        if err != nil {\n            c.Error(code, err.Error())\n            return\n        }\n        c.JSONPretty(http.StatusOK, i, \" \")\n    })\n\n    r.Get(\"/jump\", func(w http.ResponseWriter, r *http.Request) {\n        c := mgin.NewHttpContext(w, r)\n        url := c.QueryParam(\"u\")\n        if url == \"\" {\n            c.Error(http.StatusBadRequest, \"argument u expected\")\n            return\n        }\n        c.Redirect(http.StatusFound, url)\n    })\n\n    r.Post(\"/form/:name\", func(w http.ResponseWriter, r *http.Request) {\n        c := mgin.NewHttpContext(w, r)\n        n := c.Param(\"name\")\n        v := c.FormValue(n)\n        c.String(http.StatusOK, fmt.Sprintf(\"value of %s: %s\\n\", n, v))\n    })\n\n    r.Run()\n    // or r.Run(\":8080\")\n    // or http.ListenAndServe(\":8080\", r)\n}\n```\n\n## Sample #2: handler with argument mgin.Context\n\n```go\npackage main\n\nimport (\n    \"github.com/rosbit/http-mgin\"\n    \"net/http\"\n    \"fmt\"\n)\n\nfunc main() {\n    r := mgin.NewMgin()\n\n    r.GET(\"/hello\", func(c *mgin.Context) {\n        c.String(http.StatusOK, \"hello\")\n    })\n\n    r.GET(\"/json/:msg\", func(c *mgin.Context) {\n        msg := c.Param(\"msg\")\n        c.JSON(http.StatusOK, map[string]interface{} {\n            \"code\": http.StatusOK,\n            \"msg\": msg,\n        })\n    })\n\n    r.POST(\"/json\", func(c *mgin.Context) {\n        var i interface{}\n        code, err := c.ReadJSON(\u0026i)\n        if err != nil {\n            c.Error(code, err.Error())\n            return\n        }\n        c.JSONPretty(http.StatusOK, i, \" \")\n    })\n\n    r.GET(\"/jump\", func(c *mgin.Context) {\n        url := c.QueryParam(\"u\")\n        if url == \"\" {\n            c.Error(http.StatusBadRequest, \"argument u expected\")\n            return\n        }\n        c.Redirect(http.StatusFound, url)\n    })\n\n    r.POST(\"/form/:name\", func(c *mgin.Context) {\n        n := c.Param(\"name\")\n        v := c.FormValue(n)\n        c.String(http.StatusOK, fmt.Sprintf(\"value of %s: %s\\n\", n, v))\n    })\n\n    r.Run()\n    // or r.Run(\":8080\")\n    // or http.ListenAndServe(\":8080\", r)\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosbit%2Fmgin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frosbit%2Fmgin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosbit%2Fmgin/lists"}