{"id":20293064,"url":"https://github.com/mingderwang/gas","last_synced_at":"2025-04-11T11:32:52.489Z","repository":{"id":57625335,"uuid":"62362457","full_name":"mingderwang/gas","owner":"mingderwang","description":"Gas is a web framework writing in go","archived":false,"fork":false,"pushed_at":"2016-06-30T15:03:57.000Z","size":983,"stargazers_count":2,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T07:51:12.800Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"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/mingderwang.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-07-01T04:27:07.000Z","updated_at":"2017-12-30T13:56:39.000Z","dependencies_parsed_at":"2022-09-12T08:40:20.616Z","dependency_job_id":null,"html_url":"https://github.com/mingderwang/gas","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingderwang%2Fgas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingderwang%2Fgas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingderwang%2Fgas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingderwang%2Fgas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mingderwang","download_url":"https://codeload.github.com/mingderwang/gas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248384156,"owners_count":21094679,"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":[],"created_at":"2024-11-14T15:21:11.421Z","updated_at":"2025-04-11T11:32:52.469Z","avatar_url":"https://github.com/mingderwang.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gas\n\n\u003cimg src=\"https://raw.githubusercontent.com/go-gas/gas/master/logo.jpg\" alt=\"go-gas\" width=\"200px\" /\u003e\n\n[![Build Status](https://api.travis-ci.org/go-gas/gas.svg?branch=master)](https://api.travis-ci.org/go-gas/gas.svg) [![codecov](https://codecov.io/gh/go-gas/gas/branch/master/graph/badge.svg)](https://codecov.io/gh/go-gas/gas) [![Go Report Card](https://goreportcard.com/badge/github.com/go-gas/gas)](https://goreportcard.com/report/github.com/go-gas/gas)\n\nGas is a Web framework written in Go. And this is not a total complete project.\n\nI just did a minimum workable architechture.\n\nThe workable feature is:\n\n- Router (based on [fasthttprouter](https://github.com/buaazp/fasthttprouter) package)\n- Context (It can easy to render view and print json string)\n- Middleware\n- Logger middleware\n- Log package\n- Read config from a yaml file\n\nAnd Model is not complete yet. Just finished MySQL sql Builder\n\n##### all feature you can see in Example Directory.\n\n# Install\n```\n$ go get github.com/go-gas/gas\n```\n\n# Run demo\n```\n$ cd $GOPATH/src/github.com/go-gas/gas/Example\n$ go run main.go\n```\n\n# Your project file structure\n    |-- $GOPATH\n    |   |-- src\n    |       |--Your_Project_Name\n    |          |-- config\n    |              |-- default.yaml\n    |          |-- controllers\n    |              |-- default.go\n    |          |-- log\n    |          |-- models\n    |          |-- routers\n    |              |-- routers.go\n    |          |-- static\n    |          |-- views\n    |          |-- main.go\n\n# Quick start\n\n### Import\n```go\nimport (\n    \"Your_Project_Name/routers\"\n    \"github.com/go-gas/gas\"\n    \"github.com/go-gas/gas/middleware\"\n)\n```\n\n### New\n```go\ng := gas.New() // will load \"config/default.yaml\"\n```\nor\n```go\ng := gas.New(\"config/path\")\n```\n\n### Register Routes\n```go\nrouters.RegistRout(g.Router)\n```\nThen in your routers.go\n\n```go\npackage routers\n\nimport (\n    \"Your_Project_Name/controllers\"\n    \"github.com/go-gas/gas\"\n)\n\nfunc RegistRout(r *gas.Router)  {\n\n    r.Get(\"/\", controllers.IndexPage)\n    r.Post(\"/post/:param\", controllers.PostTest)\n\n    rc := \u0026controllers.RestController{}\n    r.REST(\"/User\", rc)\n\n}\n```\n\n### Register middleware\n```go\ng.Router.Use(middleware.LogMiddleware)\n```\n\nAnd you can write your own middleware function\n\n```go\nfunc LogMiddleware(next gas.CHandler) gas.CHandler {\n    return func (c *gas.Context) error  {\n\n       // do something before next handler\n\n       err := next(c)\n\n       // do something after next handler\n\n       return err\n    }\n}\n```\n\n### And done\n\n```go\ng.Run()\n```\n\n# Benchmark\n\nUsing [go-web-framework-benchmark](https://github.com/smallnest/go-web-framework-benchmark) to benchmark with another web fframework.\n\n\u003cimg src=\"https://raw.githubusercontent.com/go-gas/gas/master/benchmark.png\" alt=\"go-gas-benchmark\" /\u003e\n\n#### Benchmark-alloc\n\n\u003cimg src=\"https://raw.githubusercontent.com/go-gas/gas/master/benchmark_alloc.png\" alt=\"go-gas-benchmark-alloc\" /\u003e\n\n#### Benchmark-latency\n\n\u003cimg src=\"https://raw.githubusercontent.com/go-gas/gas/master/benchmark_latency.png\" alt=\"go-gas-benchmark-latency\" /\u003e\n\n#### Benchmark-pipeline\n\n\u003cimg src=\"https://raw.githubusercontent.com/go-gas/gas/master/benchmark-pipeline.png\" alt=\"go-gas-benchmark-pipeline\" /\u003e\n\n## Concurrency\n\n\u003cimg src=\"https://raw.githubusercontent.com/go-gas/gas/master/concurrency.png\" alt=\"go-gas-concurrency\" /\u003e\n\n#### Concurrency-alloc\n\n\u003cimg src=\"https://raw.githubusercontent.com/go-gas/gas/master/concurrency_alloc.png\" alt=\"go-gas-concurrency-alloc\" /\u003e\n\n#### Concurrency-latency\n\n\u003cimg src=\"https://raw.githubusercontent.com/go-gas/gas/master/concurrency_latency.png\" alt=\"go-gas-concurrency-latency\" /\u003e\n\n#### Concurrency-pipeline\n\n\u003cimg src=\"https://raw.githubusercontent.com/go-gas/gas/master/concurrency-pipeline.png\" alt=\"go-gas-concurrency-pipeline\" /\u003e\n\n## Benchmark conclusion\n\n[Iris](https://github.com/kataras/iris) is still the fastest web framework.\n\nBut gas is very new, so in the future\n\nI wish this framework might not be a fastest but it will very fast and full featured.\n\n### Roadmap\n- [ ] Models\n - [ ] Model fields mapping\n - [ ] ORM\n - [ ] Relation mapping\n - [x] Transaction\n - [ ] QueryBuilder\n- [ ] Session\n - [ ] Filesystem\n - [ ] Database\n - [ ] Redis\n - [ ] Memcache\n- [ ] Cache\n - [ ] Memory\n - [ ] File\n - [ ] Redis\n - [ ] Memcache\n- [ ] i18n\n- [ ] HTTPS\n- [ ] Command line tools\n- [ ] Form handler (maybe next version)\n- [ ] Security check features(csrf, xss filter...etc)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmingderwang%2Fgas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmingderwang%2Fgas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmingderwang%2Fgas/lists"}