{"id":20986622,"url":"https://github.com/dpwgc/easierweb","last_synced_at":"2026-01-19T06:01:35.201Z","repository":{"id":214195587,"uuid":"735927625","full_name":"dpwgc/easierweb","owner":"dpwgc","description":"More user-friendly, high performance Go Web framework. ~ 更简单易用的高性能 Go Web 框架","archived":false,"fork":false,"pushed_at":"2024-06-07T04:59:31.000Z","size":198,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-22T19:19:11.187Z","etag":null,"topics":["api","framework","go","http","httprouter","middleware","restful","server","web","websocket"],"latest_commit_sha":null,"homepage":"https://gitee.com/dpwgc/easierweb","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/dpwgc.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}},"created_at":"2023-12-26T13:35:50.000Z","updated_at":"2024-06-07T04:59:33.000Z","dependencies_parsed_at":"2023-12-26T16:26:22.352Z","dependency_job_id":"41ba89ca-fcf2-47e7-ac28-bd1beb41fa93","html_url":"https://github.com/dpwgc/easierweb","commit_stats":null,"previous_names":["dpwgc/easierweb"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/dpwgc/easierweb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpwgc%2Feasierweb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpwgc%2Feasierweb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpwgc%2Feasierweb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpwgc%2Feasierweb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dpwgc","download_url":"https://codeload.github.com/dpwgc/easierweb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpwgc%2Feasierweb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28562233,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api","framework","go","http","httprouter","middleware","restful","server","web","websocket"],"created_at":"2024-11-19T06:14:22.630Z","updated_at":"2026-01-19T06:01:35.168Z","avatar_url":"https://github.com/dpwgc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EasierWeb\n\n## A more user-friendly, high performance, high customizable Go Web framework\n\n### Based on [httprouter](https://github.com/julienschmidt/httprouter)\n\n### [中文文档](./README_CH.md)\n\n***\n\n## Features\n* Have a more concise way to write API. Can automatic binding query/form/body data and serialization writes to the response body.\n* Built-in websocket, server-sent events (SSE), file server.\n* Group APIs. Custom root-level, group-level, function-level middleware.\n* Highly customizable. Custom error, request and response handle functions.\n* No dependencies on too many third-party packages. Architecture is simple.\n* Support TLS and HTTP2.\n\n***\n\nSimple example of API handle\n\n```go\n// automatic binding query/form/body data and serialization writes to the response body\nfunc helloAPI(ctx *easierweb.Context, request HelloRequest) (*HelloResponse, error) {\n\n   // print the request data\n   fmt.Println(\"request data -\u003e\", request)\n\n   // return result and error. framework will help you write the response\n   return \u0026HelloResponse{Code: 1000, Msg:  \"hello\"}, nil\n}\n```\n\n***\n\n## Installation\n\n* Specify new version\n\n```\ngo get github.com/dpwgc/easierweb@v1.0.4.15\n```\n\n***\n\n## Example\n\n### Framework provides two different styles of usage\n\n### `1` Basic usage : like gin and echo ( no reflect, fast )\n### `2` Easier usage : like spring boot ( more concise way to write API handle )\n\n### [Function Usage Document](./DOC.md)\n\n***\n\n## Basic usage\n\n### API handle function have only one context parameter\n\n### Need to manually bind request data and write response data\n\n```go\npackage main\n\nimport (\n   \"github.com/dpwgc/easierweb\"\n   \"github.com/dpwgc/easierweb/middlewares\"\n   \"log\"\n   \"net/http\"\n)\n\n// basic usage example\nfunc main() {\n\n   // create a router and set middleware\n   router := easierweb.New().Use(middlewares.Logger())\n\n   // set api handle\n   router.GET(\"/hello/:name\", hello)\n\n   // runs on port 80\n   log.Fatal(router.Run(\":80\"))\n}\n\n// api handle\nfunc hello(ctx *easierweb.Context) {\n\n   // get the path parameters\n   name := ctx.Path.Get(\"name\")\n\n   // Write response, return 'hello ' + 'name'\n   ctx.WriteString(http.StatusOK, \"hello \"+name)\n}\n\n```\n\n### Access the HTTP URL in your browser\n\n\u003e `GET` http://localhost/hello/easierweb\n\n### Response data\n\n```\nhello easierweb\n```\n\n***\n\n## Easier usage\n\n### API handle function can have input object and return values\n\n### Don't need to manually bind request data and write response data. framework will help you do this\n\n```go\npackage main\n\nimport (\n   \"fmt\"\n   \"github.com/dpwgc/easierweb\"\n   \"github.com/dpwgc/easierweb/middlewares\"\n   \"log\"\n)\n\n// easier usage example\nfunc main() {\n\t\n   // create a router and set middleware\n   router := easierweb.New().Use(middlewares.Logger())\n   \n   // set api handle (use function 'EasyXXX')\n   router.EasyPOST(\"/submit\", submit)\n   \n   // runs on port 80\n   log.Fatal(router.Run(\":80\"))\n}\n\n// api handle\nfunc submit(ctx *easierweb.Context, req Request) *Response {\n\t\n   // print the request data\n   fmt.Printf(\"post request data (json body) -\u003e name: %s, mobile: %s \\n\", req.Name, req.Mobile)\n   \n   // return result\n   return \u0026Response{Code: 1000, Msg:  \"hello\"}\n}\n\n// Request json body data\ntype Request struct {\n   Name   string `json:\"name\"`\n   Mobile string `json:\"mobile\"`\n}\n\n// Response json result data\ntype Response struct {\n   Code int    `json:\"code\"`\n   Msg  string `json:\"msg\"`\n}\n```\n\n### Invoke HTTP POST API\n\n\u003e `POST` http://localhost/submit\n\n### Request body\n\n```json\n{\n  \"name\": \"hello\",\n  \"mobile\": \"12345678\"\n}\n```\n\n### Response data\n\n```json\n{\n  \"code\": 1000,\n  \"msg\": \"hello\"\n}\n```\n\n### Other notes\n\n* If you want to use 'EasyXXX' series functions. The api handle function must be in the following formats.\n\n```go\n// first input parameter must be Context\n// request struct and response struct can be slices ([]Request/*[]Response)\nfunc TestAPI(ctx *easierweb.Context, req Request) (*Response, error)\nfunc TestAPI(ctx *easierweb.Context, req Request) *Response\nfunc TestAPI(ctx *easierweb.Context, req Request) error\nfunc TestAPI(ctx *easierweb.Context, req Request)\nfunc TestAPI(ctx *easierweb.Context) (*Response, error)\nfunc TestAPI(ctx *easierweb.Context) *Response\nfunc TestAPI(ctx *easierweb.Context) error\nfunc TestAPI(ctx *easierweb.Context)\n\n// set TestAPI handle\nrouter.EasyPOST(\"/test\", TestAPI)\n```\n\n* Framework default use json format to process request and response data.\n* If you want to change the format. You can use the plugins provided by the framework as described below. Or you can implement them by yourself.\n\n```go\n// use xml format to process request and response data\nrouter := easierweb.New(easierweb.RouterOptions{\n   RequestHandle: plugins.XMLRequestHandle(),\n   ResponseHandle: plugins.XMLResponseHandle(),\n})\n```\n\n* The 'EasyXXX' series functions are compatible with basic usage. You can use the 'WriteXXX' series functions to write response.\n\n```go\nfunc TestAPI(ctx *easierweb.Context, req Request) {\n\n   fmt.Println(\"request body -\u003e\", req)\n   \n   // write xml response\n   ctx.WriteXML(http.StatusOK, Response{Code: 1000, Msg:  \"hello\"})\n}\n\n// set TestAPI handle\nrouter.EasyPOST(\"/test\", TestAPI)\n```\n\n***\n\n## Demo program\n\n### If you want to learn more about how to use it, read the demo program\n\n* demos\n  * basic `basic usage demo（includes websocket, SSE, upload and download file）`\n    * main.go\n  * easier `easier usage demo`\n    * main.go\n  * restful `restful application demo`\n    * main.go\n  * customize `customize framework configuration demo`\n    * main.go","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpwgc%2Feasierweb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdpwgc%2Feasierweb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpwgc%2Feasierweb/lists"}