{"id":21573662,"url":"https://github.com/droptheplot/glug","last_synced_at":"2025-03-18T06:27:33.526Z","repository":{"id":57602445,"uuid":"89218440","full_name":"droptheplot/glug","owner":"droptheplot","description":"Go router but with pipelines.","archived":false,"fork":false,"pushed_at":"2017-05-01T21:50:58.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-24T13:16:18.401Z","etag":null,"topics":["go","golang","golang-package","golang-router"],"latest_commit_sha":null,"homepage":"","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/droptheplot.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":"2017-04-24T08:54:38.000Z","updated_at":"2017-09-10T13:37:36.000Z","dependencies_parsed_at":"2022-09-26T20:01:02.765Z","dependency_job_id":null,"html_url":"https://github.com/droptheplot/glug","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droptheplot%2Fglug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droptheplot%2Fglug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droptheplot%2Fglug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droptheplot%2Fglug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/droptheplot","download_url":"https://codeload.github.com/droptheplot/glug/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244168411,"owners_count":20409521,"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":["go","golang","golang-package","golang-router"],"created_at":"2024-11-24T12:07:39.785Z","updated_at":"2025-03-18T06:27:33.502Z","avatar_url":"https://github.com/droptheplot.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Glug\n\n[![GoDoc](https://godoc.org/github.com/droptheplot/glug?status.svg)](https://godoc.org/github.com/droptheplot/glug)\n[![Go Report Card](https://goreportcard.com/badge/github.com/droptheplot/glug)](https://goreportcard.com/report/github.com/droptheplot/glug)\n\nInspired by [Plug](https://github.com/elixir-lang/plug) and [Rack](https://github.com/rack/rack) this package provides simple router which allows you to aggregate functions into pipelines for each endpoint. Pipelines are built with:\n\n##### Conn (struct)\n\n```go\ntype Conn struct {\n\tWriter  http.ResponseWriter\n\tRequest *http.Request\n\tParams  url.Values\n}\n```\n\nContains all request related data through plugs in pipeline.\n\n##### Plug (function)\n\n```go\ntype Plug func(Conn) Conn\n```\n\nShould modify `Conn` or `Halt()` pipeline.\n\n## Getting Started\n\n```shell\ngo get -u github.com/droptheplot/glug\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"github.com/droptheplot/glug\"\n\t\"fmt\"\n\t\"net/http\"\n)\n\nfunc Root(conn glug.Conn) glug.Conn {\n\tfmt.Fprintf(conn.Writer, \"Everyone can access this page.\")\n\treturn conn\n}\n\nfunc BlogIndex(conn glug.Conn) glug.Conn {\n\tfmt.Fprintf(conn.Writer, \"Nothing to see here!\")\n\treturn conn\n}\n\nfunc Auth(conn glug.Conn) glug.Conn {\n\thttp.Redirect(conn.Writer, conn.Request, \"/\", http.StatusFound)\n\treturn conn.Halt()\n}\n\nfunc main() {\n\tr := glug.New()\n\tr.HandleFunc(\"GET\", \"/\", Root)\n\tr.HandleFunc(\"GET\", \"/blog\", Auth, BlogIndex)\n\thttp.ListenAndServe(\":3000\", r)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdroptheplot%2Fglug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdroptheplot%2Fglug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdroptheplot%2Fglug/lists"}