{"id":34126013,"url":"https://github.com/i9si-sistemas/nine","last_synced_at":"2025-12-14T23:29:42.521Z","repository":{"id":253406455,"uuid":"843380344","full_name":"i9si-sistemas/nine","owner":"i9si-sistemas","description":"Golang HTTP Client and Modular Server framework :rocket:","archived":false,"fork":false,"pushed_at":"2025-09-01T17:26:09.000Z","size":214,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-01T19:10:41.228Z","etag":null,"topics":["go","golang","http","http-client","http-server","json","json-parser"],"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/i9si-sistemas.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-16T11:43:44.000Z","updated_at":"2025-09-01T17:25:52.000Z","dependencies_parsed_at":"2025-01-27T17:34:01.575Z","dependency_job_id":"05e4d445-8d9c-4af9-8e39-9ccaa79439fa","html_url":"https://github.com/i9si-sistemas/nine","commit_stats":null,"previous_names":["i9si-sistemas/nine"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/i9si-sistemas/nine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i9si-sistemas%2Fnine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i9si-sistemas%2Fnine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i9si-sistemas%2Fnine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i9si-sistemas%2Fnine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/i9si-sistemas","download_url":"https://codeload.github.com/i9si-sistemas/nine/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i9si-sistemas%2Fnine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27739169,"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","status":"online","status_checked_at":"2025-12-14T02:00:11.348Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["go","golang","http","http-client","http-server","json","json-parser"],"created_at":"2025-12-14T23:29:41.880Z","updated_at":"2025-12-14T23:29:42.512Z","avatar_url":"https://github.com/i9si-sistemas.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nine\n\nNine is an HTTP client and server library in Go that simplifies sending HTTP\nrequests and processing routes. With Nine, you can easily create HTTP clients\nand servers with support for middleware, response handling, and much more.\n\n## Installation\n\nTo add the Nine library to your Go project, you can use the following command:\n\n```sh\ngo get github.com/i9si-sistemas/nine\n```\n\n## Usage\n\n### Client\n\nThe HTTP client allows you to make various types of requests (GET, POST, PUT,\nPATCH, DELETE) easily.\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/i9si-sistemas/nine\"\n\ti9 \"github.com/i9si-sistemas/nine/pkg/client\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclient := nine.New(ctx)\n\tbuf, err := nine.JSON{\n\t\t\"message\": \"Hello World\",\n\t}.Buffer()\n\tif err != nil {\n\t\tfmt.Println(\"Erro ao gerar o buffer do payload:\", err)\n\t\treturn\n\t}\n\toptions := \u0026i9.Options{\n\t\tHeaders: []i9.Header{\n\t\t\t{Data: i9.Data{Key: \"Content-Type\", Value: \"application/json\"}},\n\t\t},\n\t\tBody: buf,\n\t}\n\n\tres, err := client.Get(\"https://api.exemplo.com/endpoint\", options)\n\tif err != nil {\n\t\tfmt.Println(\"Erro ao fazer requisição:\", err)\n\t\treturn\n\t}\n\tdefer res.Body.Close()\n\t // use the response\n}\n```\n\n### Server\n\nTo create a server, you can use the following code:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/i9si-sistemas/nine\"\n\ti9 \"github.com/i9si-sistemas/nine/pkg/server\"\n)\n\nfunc main() {\n\tserver := nine.NewServer(8080)\n\n\tserver.Get(\"/hello\", func(c *i9.Context) error {\n\t\treturn c.SendString(\"Hello World\")\n\t})\n\n\tserver.Get(\"/hello/:name\", func(c *i9.Context) error {\n\t\tname := c.Param(\"name\")\n\t\tmessage := fmt.Sprintf(\"Hello %s\", name)\n\t\treturn c.SendString(message)\n\t})\n\n\tlog.Fatal(server.Listen())\n}\n```\n\n### Route Handling\n\nYou can register routes for different HTTP methods using the Get, Post, Put,\nPatch, and Delete methods.\n\n```go\nserver.Post(\"/create\", func(c *i9.Context) error {\n\t\treturn c.Status(http.StatusCreated).Send([]byte(\"Recurso criado com sucesso\"))\n})\n\nserver.Route(\"/billing\", func(router i9.RouteManager) {\n\trouter.Get(\"/credits\", func(c *i9.Context) error {\n\t\treturn c.JSON(nine.JSON{\"credits\": 5000})\n\t})\n})\n\naccountGroup := server.Group(\"/account\", func (req *i9.Request, res *i9.Response) error {\n\tctx := i9.NewContext(req.Context(), req.HTTP(), res.HTTP())\n\tlog.Printf(\"receiving request from ip=[%s]\", ctx.IP())\n\treturn nil\n})\n\naccountGroup.Get(\"/:name\", func (c *i9.Context) error {\n\treturn c.JSON(nine.JSON{\"account\": c.Param(\"name\")})\n})\n```\n\n### JSON Handling\n\nThe library also provides utilities for working with JSON:\n\n```go\nserver.Get(\"/user\", func(c *i9.Context) error {\n\tdata := nine.JSON{\"name\": \"Alice\", \"age\": 30}\n\treturn c.JSON(data)\n})\n```\n\n## Contributing\n\nContributions are always welcome! Feel free to open issues and pull requests.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file\nfor more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi9si-sistemas%2Fnine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fi9si-sistemas%2Fnine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi9si-sistemas%2Fnine/lists"}