{"id":15035321,"url":"https://github.com/aliuygur/gores","last_synced_at":"2025-04-09T23:07:00.866Z","repository":{"id":55415548,"uuid":"48580192","full_name":"aliuygur/gores","owner":"aliuygur","description":"Go package that handles HTML, JSON, XML and etc. responses","archived":false,"fork":false,"pushed_at":"2021-01-01T12:48:26.000Z","size":26,"stargazers_count":105,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-09T23:06:43.014Z","etag":null,"topics":["go","golang","http-response","json-api","json-serialization","rest-api","restful"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aliuygur.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-12-25T12:41:01.000Z","updated_at":"2025-03-04T09:46:38.000Z","dependencies_parsed_at":"2022-08-14T23:50:39.977Z","dependency_job_id":null,"html_url":"https://github.com/aliuygur/gores","commit_stats":null,"previous_names":["aliuygur/gores","alioygur/gores"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliuygur%2Fgores","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliuygur%2Fgores/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliuygur%2Fgores/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliuygur%2Fgores/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aliuygur","download_url":"https://codeload.github.com/aliuygur/gores/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125625,"owners_count":21051770,"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","http-response","json-api","json-serialization","rest-api","restful"],"created_at":"2024-09-24T20:28:10.314Z","updated_at":"2025-04-09T23:07:00.840Z","avatar_url":"https://github.com/aliuygur.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gores \n\n[![Build Status](https://travis-ci.org/alioygur/gores.svg?branch=master)](https://travis-ci.org/alioygur/gores) \n[![GoDoc](https://godoc.org/github.com/alioygur/gores?status.svg)](https://godoc.org/github.com/alioygur/gores)\n[![Go Report Card](https://goreportcard.com/badge/github.com/alioygur/gores)](https://goreportcard.com/report/github.com/alioygur/gores)\n\nhttp response utility library for Go\n\nthis package is very small and lightweight, useful for RESTful APIs.\n\n\n## installation\n\n`go get github.com/alioygur/gores`\n\n## requirements\n\ngores library requires Go version `\u003e=1.7`\n\n## usage\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"net/http\"\n\n\t\"github.com/alioygur/gores\"\n)\n\ntype User struct {\n\tName  string\n\tEmail string\n\tAge   int\n}\n\nfunc main() {\n\t// Plain text response\n\thttp.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tgores.String(w, http.StatusOK, \"Hello World\")\n\t})\n\n\t// HTML response\n\thttp.HandleFunc(\"/html\", func(w http.ResponseWriter, r *http.Request) {\n\t\tgores.HTML(w, http.StatusOK, \"\u003ch1\u003eHello World\u003c/h1\u003e\")\n\t})\n\n\t// JSON response\n\thttp.HandleFunc(\"/json\", func(w http.ResponseWriter, r *http.Request) {\n\t\tuser := User{Name: \"Ali\", Email: \"ali@example.com\", Age: 28}\n\t\tgores.JSON(w, http.StatusOK, user)\n\t})\n\n\t// File response\n\thttp.HandleFunc(\"/file\", func(w http.ResponseWriter, r *http.Request) {\n\t\terr := gores.File(w, r, \"./path/to/file.html\")\n\n\t\tif err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t}\n\t})\n\n\t// Download file\n\thttp.HandleFunc(\"/download-file\", func(w http.ResponseWriter, r *http.Request) {\n\t\terr := gores.Download(w, r, \"./path/to/file.pdf\", \"example.pdf\")\n\n\t\tif err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t}\n\t})\n\n\t// No content\n\thttp.HandleFunc(\"/no-content\", func(w http.ResponseWriter, r *http.Request) {\n\t\tgores.NoContent(w)\n\t})\n\n\t// Error response\n\thttp.HandleFunc(\"/error\", func(w http.ResponseWriter, r *http.Request) {\n\t\tgores.Error(w, http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))\n\t})\n\n\terr := http.ListenAndServe(\":8000\", nil)\n\tif err != nil {\n\t\tlog.Fatal(\"ListenAndServe: \", err)\n\t}\n}\n```\n\nfor more documentation [godoc](https://godoc.org/github.com/alioygur/gores)\n\n## Contribute\n\n**Use issues for everything**\n\n- Report problems\n- Discuss before sending a pull request\n- Suggest new features/recipes\n- Improve/fix documentation\n\n## Thanks \u0026 Authors\n\nI use code/got inspiration from these excellent libraries:\n\n- [labstack/echo](https://github.com/labstack/echo) micro web framework\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliuygur%2Fgores","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faliuygur%2Fgores","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliuygur%2Fgores/lists"}