{"id":19034785,"url":"https://github.com/sakiib/apiserver","last_synced_at":"2026-06-30T00:30:55.781Z","repository":{"id":55577422,"uuid":"321244833","full_name":"sakiib/apiServer","owner":"sakiib","description":null,"archived":false,"fork":false,"pushed_at":"2021-02-17T12:14:58.000Z","size":1675,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-02T05:16:38.820Z","etag":null,"topics":["basic-authentication","cli","cobra","go","golang","helm-charts","jwt-authentication"],"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/sakiib.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":"2020-12-14T05:37:28.000Z","updated_at":"2024-11-02T15:53:44.000Z","dependencies_parsed_at":"2022-08-15T03:30:59.285Z","dependency_job_id":null,"html_url":"https://github.com/sakiib/apiServer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sakiib%2FapiServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sakiib%2FapiServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sakiib%2FapiServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sakiib%2FapiServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sakiib","download_url":"https://codeload.github.com/sakiib/apiServer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240089021,"owners_count":19746180,"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":["basic-authentication","cli","cobra","go","golang","helm-charts","jwt-authentication"],"created_at":"2024-11-08T21:47:28.208Z","updated_at":"2026-05-05T09:30:20.773Z","avatar_url":"https://github.com/sakiib.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# API server\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/sakiib/apiServer)](https://goreportcard.com/report/github.com/sakiib/apiServer)\n\n### RESTful API using [go](https://github.com/golang), [cobra CLI](https://github.com/spf13/cobra), [gorilla mux](https://github.com/gorilla/mux), Basic Auth, [JWT Auth](https://github.com/dgrijalva/jwt-go)\n\n--- \nAPI Endpoints\n| Endpoint | Function | Method | StatusCode | Auth |\n| -------- | -------- | ------ | ---------- | ---- |\n| `/api/login` | LogIn | POST | Success - StatusOK, Failure - StatusUnauthorized | Basic |\n| `/api/users` | GetUsers | GET | Success - StatusOK | JWT |\n| `/api/user/{id}` | GetUser | GET | Success - StatusOK, Failure - StatusNoContent | JWT |\n| `/api/user/{id}` | AddUser | POST | Success - StatusCreated, Failure - StatusConflict | JWT |\n| `/api/user/{id}` | UpdateUser | PUT | Success - StatusCreated, Failure - StatusNoContent | JWT |\n| `/api/user/{id}` | DeleteUser | DELETE | Success - StatusOK, Failure - StatusNoContent | JWT |\n\n---\nInstallation\n* `go install github.com/sakiib/apiServer`\n\n---\nCLI Commands:\n* help with the start commands `apiServer start -h` or `apiServer start --help`\n* start the API server on the given port (def: 8080) `apiServer start --port=8080`\n* start the API server with no auth required flag (def: auth required): `apiServer start --auth=false`\n\n--- \nSet Environment variables for Basic Authentication\n`export username=sakib`\n`export password=12345`\n\n---\nData Model\n```\npackage model\n\ntype Movie struct {\n\tID     string `json:\"id\"`\n\tTitle  string `json:\"title\"`\n\tGenre  string `json:\"genre\"`\n\tRating int    `json:\"rating\"`\n}\n\n```\n```\npackage model\n\ntype User struct {\n\tID              string  `json:\"id\"`\n\tFirstName       string  `json:\"firstname\"`\n\tLastName        string  `json:\"lastname\"`\n\tFavouriteMovies []Movie `json:\"favouriteMovies\"`\n}\n\n```\n\n---\nAuthentication Method\n* Basic Authentication\n* JWT Authentication (ToDo)\n\n---\nTesting the API Endpoints\n* Primary API endpoints testing using [Postman](https://github.com/postmanlabs) \n* E2E Testing. \n\t* modlues used: `net/http/httptest`, `testing`, `bytes`, `encoding/json`, `net/http`. \n\t* Checks for the response Status Code against the Expected Status Code.\n\n---\nResources:\n* [sysdevbd learn GO](https://sysdevbd.com/go/)\n* [Encoding \u0026 Decoding JSON](https://kevin.burke.dev/kevin/golang-json-http/)\n* [A Beginner’s Guide to HTTP and REST](https://code.tutsplus.com/tutorials/a-beginners-guide-to-http-and-rest--net-16340)\n* [HTTP Response Status Codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)\n* [TutorialEdge Creating A Simple Web Server with Golang](https://tutorialedge.net/golang/creating-simple-web-server-with-golang/)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsakiib%2Fapiserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsakiib%2Fapiserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsakiib%2Fapiserver/lists"}