{"id":13764095,"url":"https://github.com/aofei/air","last_synced_at":"2025-04-04T18:06:08.444Z","repository":{"id":57480589,"uuid":"63778439","full_name":"aofei/air","owner":"aofei","description":"An ideally refined web framework for Go.","archived":false,"fork":false,"pushed_at":"2023-03-07T01:03:38.000Z","size":1180,"stargazers_count":440,"open_issues_count":8,"forks_count":37,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-10-30T06:57:41.181Z","etag":null,"topics":["air","framework","go","web"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/aofei/air","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/aofei.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}},"created_at":"2016-07-20T12:09:48.000Z","updated_at":"2024-09-27T11:32:30.000Z","dependencies_parsed_at":"2023-09-24T06:32:17.517Z","dependency_job_id":null,"html_url":"https://github.com/aofei/air","commit_stats":{"total_commits":959,"total_committers":4,"mean_commits":239.75,"dds":"0.014598540145985384","last_synced_commit":"d0d372c2238d6499975bdbf2a8aa1f3ca3024644"},"previous_names":["sheng/air"],"tags_count":68,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aofei%2Fair","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aofei%2Fair/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aofei%2Fair/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aofei%2Fair/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aofei","download_url":"https://codeload.github.com/aofei/air/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226213,"owners_count":20904465,"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":["air","framework","go","web"],"created_at":"2024-08-03T15:01:13.649Z","updated_at":"2025-04-04T18:06:08.423Z","avatar_url":"https://github.com/aofei.png","language":"Go","readme":"# Air\n\n[![GitHub Actions](https://github.com/aofei/air/workflows/Main/badge.svg)](https://github.com/aofei/air)\n[![codecov](https://codecov.io/gh/aofei/air/branch/master/graph/badge.svg)](https://codecov.io/gh/aofei/air)\n[![Go Report Card](https://goreportcard.com/badge/github.com/aofei/air)](https://goreportcard.com/report/github.com/aofei/air)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/aofei/air)](https://pkg.go.dev/github.com/aofei/air)\n\nAn ideally refined web framework for Go.\n\nHigh-performance? Fastest? Almost all web frameworks are using these words to\ntell people that they are the best. Maybe they are, maybe not. Air does not\nintend to follow the crowd. Our goal is always to strive to make it easy for\npeople to use Air to build their web applications. So, we can only guarantee you\none thing: **Air can serve properly**.\n\n## Features\n\n* API\n\t* As less as possible\n\t* As clean as possible\n\t* As simple as possible\n\t* As expressive as possible\n* Server\n\t* HTTP/2 (h2 \u0026 h2c) support\n\t* SSL/TLS support\n\t* ACME support\n\t* PROXY (v1 \u0026 v2) support\n\t* Graceful shutdown support\n* Router\n\t* Based on the Radix Tree\n\t* Zero dynamic memory allocation\n\t* Blazing fast\n\t* Has a good inspection mechanism\n\t* Group routes support\n* Gas (aka middleware)\n\t* Router level:\n\t\t* Before router\n\t\t* After router\n\t* Route level\n\t* Group level\n* WebSocket\n\t* Full-duplex communication\n* Reverse proxy\n\t* Retrieves resources on behalf of a client from another server\n\t* Supported protocols:\n\t\t* HTTP\n\t\t* WebSocket\n\t\t* gRPC\n* Binder\n\t* Binds HTTP request body into the provided struct\n\t* Supported MIME types:\n\t\t* `application/json`\n\t\t* `application/xml`\n\t\t* `application/protobuf`\n\t\t* `application/msgpack`\n\t\t* `application/toml`\n\t\t* `application/yaml`\n\t\t* `application/x-www-form-urlencoded`\n\t\t* `multipart/form-data`\n* Renderer\n\t* Rich template functions\n\t* Hot update support\n* Minifier\n\t* Minifies HTTP response on the fly\n\t* Supported MIME types:\n\t\t* `text/html`\n\t\t* `text/css`\n\t\t* `application/javascript`\n\t\t* `application/json`\n\t\t* `application/xml`\n\t\t* `image/svg+xml`\n* Gzip\n\t* Compresses HTTP response by using the gzip\n\t* Default MIME types:\n\t\t* `text/plain`\n\t\t* `text/html`\n\t\t* `text/css`\n\t\t* `application/javascript`\n\t\t* `application/json`\n\t\t* `application/xml`\n\t\t* `application/toml`\n\t\t* `application/yaml`\n\t\t* `image/svg+xml`\n* Coffer\n\t* Accesses binary asset files by using the runtime memory\n\t* Significantly improves the performance of the [`air.Response.WriteFile`](https://pkg.go.dev/github.com/aofei/air#Response.WriteFile)\n\t* Asset file minimization and gzip support\n\t* Default asset file extensions:\n\t\t* `.html`\n\t\t* `.css`\n\t\t* `.js`\n\t\t* `.json`\n\t\t* `.xml`\n\t\t* `.toml`\n\t\t* `.yaml`\n\t\t* `.yml`\n\t\t* `.svg`\n\t\t* `.jpg`\n\t\t* `.jpeg`\n\t\t* `.png`\n\t\t* `.gif`\n\t* Hot update support\n* I18n\n\t* Adapt to the request's favorite conventions\n\t* Implanted into the [`air.Response.Render`](https://pkg.go.dev/github.com/aofei/air#Response.Render)\n\t* Hot update support\n* Error\n\t* Centralized handling\n\n## Installation\n\nOpen your terminal and execute\n\n```bash\n$ go get github.com/aofei/air\n```\n\ndone.\n\n\u003e The only requirement is the [Go](https://golang.org), at least v1.13.\n\n## Hello, 世界\n\nCreate a file named `hello.go`\n\n```go\npackage main\n\nimport \"github.com/aofei/air\"\n\nfunc main() {\n\tair.Default.GET(\"/\", func(req *air.Request, res *air.Response) error {\n\t\treturn res.WriteString(\"Hello, 世界\")\n\t})\n\tair.Default.Serve()\n}\n```\n\nand run it\n\n```bash\n$ go run hello.go\n```\n\nthen visit `http://localhost:8080`.\n\n## Documentation\n\nDoes all web frameworks need to have a complicated (or a lovely but lengthy)\nwebsite to guide people how to use them? Well, Air has only one\n[Doc](https://pkg.go.dev/github.com/aofei/air) with useful comments. In fact,\nAir is so succinct that you don't need to understand how to use it through a\nlarge document.\n\n## Gases\n\nAs we all know that the air of Earth is a mixture of gases. So the same is that\nAir adopts the gas as its composition. Everyone can create new gas and use it\nwithin Air simply.\n\nA gas is a function chained in the HTTP request-response cycle with access to\nthe [`air.Request`](https://pkg.go.dev/github.com/aofei/air#Request) and\n[`air.Response`](https://pkg.go.dev/github.com/aofei/air#Response) which it uses\nto perform a specific action, for example, logging every request or recovering\nfrom panics.\n\n```go\nreturn func(next air.Handler) air.Handler {\n\treturn func(req *air.Request, res *air.Response) error {\n\t\t// Do something here...\n\t\treturn next(req, res) // Execute the next handler\n\t}\n}\n```\n\nIf you already have some good HTTP middleware, you can simply wrap them into\ngases by calling the\n[`air.WrapHTTPMiddleware`](https://pkg.go.dev/github.com/aofei/air#WrapHTTPMiddleware).\n\nIf you are looking for some useful gases, simply visit\n[here](https://github.com/air-gases).\n\n## Examples\n\nIf you want to be familiar with Air as soon as possible, simply visit\n[here](https://github.com/air-examples).\n\n## FAQ\n\n### Why named Air?\n\n\"A\" for \"An\", \"I\" for \"Ideally\" and \"R\" for \"Refined\". So, Air.\n\n### Why based on the [net/http](https://pkg.go.dev/net/http)?\n\nIn fact, I've tried to implement a full-featured HTTP server (just like the\nawesome [valyala/fasthttp](https://github.com/valyala/fasthttp)). But when I\nfinished about half of the work, I suddenly realized: What about stability? What\nabout those awesome middleware outside? And, seriously, what am I doing?\n\n### Why not just use the [net/http](https://pkg.go.dev/net/http)?\n\nYeah, we can of course use the [net/http](https://pkg.go.dev/net/http) directly,\nafter all, it can meet many requirements. But, ummm... it's really too stable,\nisn't it? I mean, to ensure Go's backward compatibility (which is extremely\nnecessary), we can't easily add some handy features to the\n[net/http](https://pkg.go.dev/net/http). And, the\n[`http.Request`](https://pkg.go.dev/net/http#Request) does not only represents\nthe request received by the server, but also represents the request made by the\nclient. In some cases it can be confusing. So why not just use the\n[net/http](https://pkg.go.dev/net/http) as the underlying server, and then\nimplement a refined web framework that are only used for the server-side on top\nof it?\n\n### Do you know we already got the [gin-gonic/gin](https://github.com/gin-gonic/gin) and [labstack/echo](https://github.com/labstack/echo)?\n\nOf course, I knew it when I started Go. And, I love both of them! But, why not\ntry some new flavors? Are you sure you prefer them instead of Air? Don't even\ngive Air a try? Wow... well, maybe Air is not for you. After all, it's for\npeople who love to try new things. Relax and continue to maintain the status\nquo, you will be fine.\n\n### What about the fantastic [Gorilla web toolkit](https://github.com/gorilla)?\n\nJust call the\n[`air.WrapHTTPHandler`](https://pkg.go.dev/github.com/aofei/air#WrapHTTPHandler)\nand\n[`air.WrapHTTPMiddleware`](https://pkg.go.dev/github.com/aofei/air#WrapHTTPMiddleware).\n\n### Is Air good enough?\n\nFar from enough. But it's already working.\n\n## Community\n\nIf you want to discuss Air, or ask questions about it, simply post questions or\nideas [here](https://github.com/aofei/air/issues).\n\n## Contributing\n\nIf you want to help build Air, simply follow\n[this](https://github.com/aofei/air/wiki/Contributing) to send pull requests\n[here](https://github.com/aofei/air/pulls).\n\n## License\n\nThis project is licensed under the MIT License.\n\nLicense can be found [here](LICENSE).\n","funding_links":[],"categories":["web框架","Misc","Web Frameworks","Web框架","web框架`web 框架`","Utility"],"sub_categories":["版本控制","HTTP Clients","Utility/Miscellaneous","实用程序/Miscellaneous","版本控制`版本控制相关库`","Fail injection","交流"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faofei%2Fair","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faofei%2Fair","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faofei%2Fair/lists"}