{"id":22813367,"url":"https://github.com/southclaws/pocket","last_synced_at":"2025-04-22T16:54:10.861Z","repository":{"id":149829388,"uuid":"201516728","full_name":"Southclaws/pocket","owner":"Southclaws","description":"A neat little web library to help you write cleaner HTTP request handlers!","archived":false,"fork":false,"pushed_at":"2019-09-05T17:49:39.000Z","size":50,"stargazers_count":8,"open_issues_count":4,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T16:51:13.484Z","etag":null,"topics":["go-http","go-web","http","http-handlers","reflection"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Southclaws.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-08-09T17:56:22.000Z","updated_at":"2022-04-19T12:03:24.000Z","dependencies_parsed_at":"2023-09-15T05:01:38.032Z","dependency_job_id":null,"html_url":"https://github.com/Southclaws/pocket","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/Southclaws%2Fpocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Southclaws%2Fpocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Southclaws%2Fpocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Southclaws%2Fpocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Southclaws","download_url":"https://codeload.github.com/Southclaws/pocket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250283441,"owners_count":21405163,"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-http","go-web","http","http-handlers","reflection"],"created_at":"2024-12-12T12:27:07.085Z","updated_at":"2025-04-22T16:54:10.852Z","avatar_url":"https://github.com/Southclaws.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pocket Gopher!\n\n\u003e Pocket gophers, commonly referred to as just gophers, are burrowing rodents of the family Geomyidae.\n\n[![Actions Status](https://github.com/Southclaws/pocket/workflows/Go/badge.svg)](https://github.com/Southclaws/pocket/actions)\n\n**(Work In Progress)**\n\nPocket is a neat little web library to help you write cleaner HTTP request handlers!\n\nIt's inspired by how a few other languages provide handler APIs, mainly [Rocket](https://rocket.rs/) (hence the name!)\n\n## Example\n\nHere's a quick example:\n\n```go\nfunc handler(props struct {\n    UserID   string `param:\"user_id\"`\n    BodyJSON J\n}) pocket.Responder {\n    // Do stuff with `props`!\n    // simply return an error or a responder! no more writing to w!\n}\n```\n\n## Why?\n\nGo has a great ecosystem for HTTP middleware thanks to the standard Request/ResponseWriter interface. This pattern is\ngreat, until it comes to writing your actual business logic handlers. The Request/ResponseWriter is just too low level\nfor doing quick things like getting query parameters or grabbing some JSON.\n\nSure, you can write some helpers for this but then if you have a few projects, you end up copying/importing and calling\nthis boilerplate all over the place. Doing it declaratively is much nicer!\n\nNote: This package makes generous use of reflection and, while all efforts are made to cache unnecessary reflection\ncalls and perform most of at handler generation-time, this reflection _may_ impact extremely high-traffic web servers.\nThere are currently no benchmarks but this is something I plan to work on in future.\n\n## Some Ideas\n\n_A scratchpad for ideas for this library!_\n\n- `func(string)`/`func() string` signatures for quick and easy text requests/responses.\n- `func(T)`/`func(T)` signatures for quick JSON endpoints.\n- nice default for `func(...) error` signatures\n- Provide some configuration for the handler generator:\n  - mapping from `error` types to statuses, for those `func(...) error` sigs.\n  - wrap JSON responses in some default body\n- generate index/sitemap/documentation based on signatures\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsouthclaws%2Fpocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsouthclaws%2Fpocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsouthclaws%2Fpocket/lists"}