{"id":20063889,"url":"https://github.com/writeas/impart","last_synced_at":"2026-05-08T12:51:00.750Z","repository":{"id":57492263,"uuid":"41504195","full_name":"writeas/impart","owner":"writeas","description":"Utilities for a JSON-based API.","archived":false,"fork":false,"pushed_at":"2020-03-28T17:29:43.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-02T10:41:39.814Z","etag":null,"topics":["api-rest","writeas"],"latest_commit_sha":null,"homepage":null,"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/writeas.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":"2015-08-27T18:30:31.000Z","updated_at":"2020-11-12T21:55:56.000Z","dependencies_parsed_at":"2022-09-02T00:20:41.821Z","dependency_job_id":null,"html_url":"https://github.com/writeas/impart","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/writeas/impart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writeas%2Fimpart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writeas%2Fimpart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writeas%2Fimpart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writeas%2Fimpart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/writeas","download_url":"https://codeload.github.com/writeas/impart/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writeas%2Fimpart/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32781561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["api-rest","writeas"],"created_at":"2024-11-13T13:44:07.149Z","updated_at":"2026-05-08T12:51:00.731Z","avatar_url":"https://github.com/writeas.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"impart\n======\n\n![MIT license](https://img.shields.io/github/license/writeas/impart.svg) [![#writeas on freenode](https://img.shields.io/badge/freenode-%23writeas-blue.svg)](http://webchat.freenode.net/?channels=writeas) [![Discuss on our forum](https://img.shields.io/discourse/https/discuss.write.as/users.svg?label=forums)](https://discuss.write.as/c/development)\n\n**impart** is a library for the final layer between the API and the consumer. It's used in the latest [Write.as](https://write.as) and [HTMLhouse](https://html.house) APIs.\n\nWe're still in the early stages of development, so there may be breaking changes.\n\n## Example use\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/writeas/impart\"\n\t\"net/http\"\n)\n\ntype handlerFunc func(w http.ResponseWriter, r *http.Request) error\n\nfunc main() {\n\thttp.HandleFunc(\"/\", handle(index))\n\thttp.ListenAndServe(\"127.0.0.1:8080\", nil)\n}\n\nfunc index(w http.ResponseWriter, r *http.Request) error {\n\tfmt.Fprintf(w, \"Hello world!\")\n\n\treturn nil\n}\n\nfunc handle(f handlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\thandleError(w, r, func() error {\n\t\t\t// Do authentication...\n\n\t\t\t// Handle the request\n\t\t\terr := f(w, r)\n\n\t\t\t// Log the request and result...\n\n\t\t\treturn err\n\t\t}())\n\t}\n}\n\nfunc handleError(w http.ResponseWriter, r *http.Request, err error) {\n\tif err == nil {\n\t\treturn\n\t}\n\n\tif err, ok := err.(impart.HTTPError); ok {\n\t\timpart.WriteError(w, err)\n\t\treturn\n\t}\n\n\timpart.WriteError(w, impart.HTTPError{http.StatusInternalServerError, \"Internal server error :(\"})\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwriteas%2Fimpart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwriteas%2Fimpart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwriteas%2Fimpart/lists"}