All Projects → aofei → Air

aofei / Air

Licence: mit
An ideally refined web framework for Go.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Air

Libgdx
Desktop/Android/HTML5/iOS Java game development framework
Stars: ✭ 19,420 (+4730.85%)
Mutual labels:  framework
Mip
[Deprecated] 请查看 mip2
Stars: ✭ 390 (-2.99%)
Mutual labels:  framework
Larapi
An API-friendly fork of Laravel. Authentication, error handling, resource filtering, sorting, pagination and much more included
Stars: ✭ 397 (-1.24%)
Mutual labels:  framework
Qpc
QP/C real-time embedded framework/RTOS for embedded systems based on active objects (actors) and hierarchical state machines
Stars: ✭ 379 (-5.72%)
Mutual labels:  framework
Mam mol
$mol - fastest reactive micro-modular compact flexible lazy ui web framework.
Stars: ✭ 385 (-4.23%)
Mutual labels:  framework
Shadowview
An iOS Library that makes shadows management easy on UIView.
Stars: ✭ 391 (-2.74%)
Mutual labels:  framework
Raxx
Interface for HTTP webservers, frameworks and clients
Stars: ✭ 378 (-5.97%)
Mutual labels:  framework
Tentcss
🌿 A CSS survival kit. Includes only the essentials to make camp.
Stars: ✭ 400 (-0.5%)
Mutual labels:  framework
Kooper
Kooper is a simple Go library to create Kubernetes operators and controllers.
Stars: ✭ 388 (-3.48%)
Mutual labels:  framework
Githubupdates
Cocoa framework to install application updates from GitHub releases.
Stars: ✭ 393 (-2.24%)
Mutual labels:  framework
Material Framework
[Unmaintained] An easy to use material design based framework.
Stars: ✭ 383 (-4.73%)
Mutual labels:  framework
Ef.js
The timeless, future facing front-end framework
Stars: ✭ 385 (-4.23%)
Mutual labels:  framework
Vugu
Vugu: A modern UI library for Go+WebAssembly (experimental)
Stars: ✭ 4,251 (+957.46%)
Mutual labels:  framework
Hyperapp
The tiny framework for building hypertext applications.
Stars: ✭ 18,724 (+4557.71%)
Mutual labels:  framework
Ozzo Routing
An extremely fast Go (golang) HTTP router that supports regular expression route matching. Comes with full support for building RESTful APIs.
Stars: ✭ 398 (-1%)
Mutual labels:  framework
Transmittable Thread Local
📌 TransmittableThreadLocal (TTL), the missing Java™ std lib(simple & 0-dependency) for framework/middleware, provide an enhanced InheritableThreadLocal that transmits values between threads even using thread pooling components.
Stars: ✭ 4,678 (+1063.68%)
Mutual labels:  framework
Di
Dependency injection container in go (golang)
Stars: ✭ 390 (-2.99%)
Mutual labels:  framework
Framework
.NET Core Extensions and Helper NuGet packages.
Stars: ✭ 399 (-0.75%)
Mutual labels:  framework
Puzzle Js
⚡ Micro frontend framework for scalable and blazing fast websites.
Stars: ✭ 398 (-1%)
Mutual labels:  framework
Bach
Bach Testing Framework
Stars: ✭ 392 (-2.49%)
Mutual labels:  framework

Air

GitHub Actions codecov Go Report Card PkgGoDev

An ideally refined web framework for Go.

High-performance? Fastest? Almost all web frameworks are using these words to tell people that they are the best. Maybe they are, maybe not. Air does not intend to follow the crowd. Our goal is always to strive to make it easy for people to use Air to build their web applications. So, we can only guarantee you one thing: Air can serve properly.

Features

  • API
    • As less as possible
    • As clean as possible
    • As simple as possible
    • As expressive as possible
  • Server
    • HTTP/2 (h2 & h2c) support
    • SSL/TLS support
    • ACME support
    • PROXY (v1 & v2) support
    • Graceful shutdown support
  • Router
    • Based on the Radix Tree
    • Zero dynamic memory allocation
    • Blazing fast
    • Has a good inspection mechanism
    • Group routes support
  • Gas (aka middleware)
    • Router level:
      • Before router
      • After router
    • Route level
    • Group level
  • WebSocket
    • Full-duplex communication
  • Reverse proxy
    • Retrieves resources on behalf of a client from another server
    • Supported protocols:
      • HTTP
      • WebSocket
      • gRPC
  • Binder
    • Binds HTTP request body into the provided struct
    • Supported MIME types:
      • application/json
      • application/xml
      • application/protobuf
      • application/msgpack
      • application/toml
      • application/yaml
      • application/x-www-form-urlencoded
      • multipart/form-data
  • Renderer
    • Rich template functions
    • Hot update support
  • Minifier
    • Minifies HTTP response on the fly
    • Supported MIME types:
      • text/html
      • text/css
      • application/javascript
      • application/json
      • application/xml
      • image/svg+xml
  • Gzip
    • Compresses HTTP response by using the gzip
    • Default MIME types:
      • text/plain
      • text/html
      • text/css
      • application/javascript
      • application/json
      • application/xml
      • application/toml
      • application/yaml
      • image/svg+xml
  • Coffer
    • Accesses binary asset files by using the runtime memory
    • Significantly improves the performance of the air.Response.WriteFile
    • Asset file minimization and gzip support
    • Default asset file extensions:
      • .html
      • .css
      • .js
      • .json
      • .xml
      • .toml
      • .yaml
      • .yml
      • .svg
      • .jpg
      • .jpeg
      • .png
      • .gif
    • Hot update support
  • I18n
    • Adapt to the request's favorite conventions
    • Implanted into the air.Response.Render
    • Hot update support
  • Error
    • Centralized handling

Installation

Open your terminal and execute

$ go get github.com/aofei/air

done.

The only requirement is the Go, at least v1.13.

Hello, 世界

Create a file named hello.go

package main

import "github.com/aofei/air"

func main() {
	air.Default.GET("/", func(req *air.Request, res *air.Response) error {
		return res.WriteString("Hello, 世界")
	})
	air.Default.Serve()
}

and run it

$ go run hello.go

then visit http://localhost:8080.

Documentation

Does all web frameworks need to have a complicated (or a lovely but lengthy) website to guide people how to use them? Well, Air has only one Doc with useful comments. In fact, Air is so succinct that you don't need to understand how to use it through a large document.

Gases

As we all know that the air of Earth is a mixture of gases. So the same is that Air adopts the gas as its composition. Everyone can create new gas and use it within Air simply.

A gas is a function chained in the HTTP request-response cycle with access to the air.Request and air.Response which it uses to perform a specific action, for example, logging every request or recovering from panics.

return func(next air.Handler) air.Handler {
	return func(req *air.Request, res *air.Response) error {
		// Do something here...
		return next(req, res) // Execute the next handler
	}
}

If you already have some good HTTP middleware, you can simply wrap them into gases by calling the air.WrapHTTPMiddleware.

If you are looking for some useful gases, simply visit here.

Examples

If you want to be familiar with Air as soon as possible, simply visit here.

FAQ

Why named Air?

"A" for "An", "I" for "Ideally" and "R" for "Refined". So, Air.

Why based on the net/http?

In fact, I've tried to implement a full-featured HTTP server (just like the awesome valyala/fasthttp). But when I finished about half of the work, I suddenly realized: What about stability? What about those awesome middleware outside? And, seriously, what am I doing?

Why not just use the net/http?

Yeah, we can of course use the net/http directly, after all, it can meet many requirements. But, ummm... it's really too stable, isn't it? I mean, to ensure Go's backward compatibility (which is extremely necessary), we can't easily add some handy features to the net/http. And, the http.Request does not only represents the request received by the server, but also represents the request made by the client. In some cases it can be confusing. So why not just use the net/http as the underlying server, and then implement a refined web framework that are only used for the server-side on top of it?

Do you know we already got the gin-gonic/gin and labstack/echo?

Of course, I knew it when I started Go. And, I love both of them! But, why not try some new flavors? Are you sure you prefer them instead of Air? Don't even give Air a try? Wow... well, maybe Air is not for you. After all, it's for people who love to try new things. Relax and continue to maintain the status quo, you will be fine.

What about the fantastic Gorilla web toolkit?

Just call the air.WrapHTTPHandler and air.WrapHTTPMiddleware.

Is Air good enough?

Far from enough. But it's already working.

Community

If you want to discuss Air, or ask questions about it, simply post questions or ideas here.

Contributing

If you want to help build Air, simply follow this to send pull requests here.

License

This project is licensed under the MIT License.

License can be found here.

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].