{"id":15272449,"url":"https://github.com/fajarbc/learn-gin","last_synced_at":"2026-01-30T05:11:58.595Z","repository":{"id":115653253,"uuid":"448383758","full_name":"fajarbc/learn-gin","owner":"fajarbc","description":"Learning Gin Framework ","archived":false,"fork":false,"pushed_at":"2022-04-29T15:02:38.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-27T19:28:51.146Z","etag":null,"topics":["gin","gin-gonic","go","golang"],"latest_commit_sha":null,"homepage":"","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/fajarbc.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":"2022-01-15T20:28:36.000Z","updated_at":"2022-03-24T21:19:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"6da77eb5-419c-42ad-97e8-1348bf6064ea","html_url":"https://github.com/fajarbc/learn-gin","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/fajarbc%2Flearn-gin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajarbc%2Flearn-gin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajarbc%2Flearn-gin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajarbc%2Flearn-gin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fajarbc","download_url":"https://codeload.github.com/fajarbc/learn-gin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244990069,"owners_count":20543614,"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":["gin","gin-gonic","go","golang"],"created_at":"2024-09-30T09:07:08.368Z","updated_at":"2026-01-30T05:11:53.548Z","avatar_url":"https://github.com/fajarbc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Learn Gin Framework (Golang)\n\n## Description\nLearning golang framework gin.\nStack:\n   - Go\n   - MySQL\n   - Docker\n\nImplements:\n   - Gin\n   - Gorm MySQL CRUD (currently: create, read)\n   - JWT Authentication\n   - Docker using Dockerfile\n\nThere is nothing in http://localhost:8080 yet, but you can do :\n   - Register/Login as an Author\n   - Save/Get Your Articles\n\nUse Postman for completes endpoints: https://www.getpostman.com/collections/e66fcfef85e70524e3ac\n\n## Endpoint examples\nAn example of `POST` request to save new Article with its Author to http://localhost:8080/api/articles \n```json\n{\n    \"title\": \"First Post Title\",\n    \"content\": \"Lorem ipsum this is article content\",\n    \"slug\": \"post-1\",\n    \"status\": 1\n}\n```\nMake sure you are already authenticated, otherwise it will respond with 400.\nTo authenticate, you need to :\n1. Register, make request to http://localhost:8080/author/register\n   ```json\n   {\n      \"name\": \"Fajar\",\n      \"email\": \"user@mail.com\",\n      \"status\": 1,\n      \"username\": \"user\",\n      \"password\": \"user\"\n   }\n   ```\n2. Login, make request to http://localhost:8080/author/login\n   ```json\n   {\n      \"username\": \"user\",\n      \"password\": \"user\"\n   }\n   ```\n\n## Install\nAfter you clone this repo\n```bash\ngit clone https://github.com/fajarbc/learn-gin.git \u0026\u0026 cd learn-gin\n```\nThen, before you could run the app\n1. install/downloads the dependecies first.\n   ```\n   go mod download\n   ```\n2. make database `go_articles`\n3. (optional) For development, hot reloading using [Air](https://github.com/cosmtrek/air)\n   1. Install Air\n      ```bash\n      go get github.com/cosmtrek/air@latest\n      ```\n   2. Add alias to `.bashrc`\n      1. File check where `.bashrc` should be\n         ```bash\n         echo ~\n         // output: C:/Users/fajarbc\n         ```\n      2. Check your air executable, in my case i found it on `C:\\Users\\fajarbc\\go\\bin\\bin`\n      3. Next, go to `C:/Users/fajarbc` and add this line to file `.bashrc` (create it yourself if it's not created yet) :\n         ```bash\n         alias air='~/go/bin/bin/air'\n         ```\n      Note: `~` equals `C:\\Users\\fajarbc`\n   3. Check in your terminal by type ```air -v```\n4. Don't forget to setup your env by copy file `.env.example` and rename it to `.env` and then you can start to change the variables inside it.\n\n## Run\nThere are 4 ways to run the app. Once it runs, you could reach `http://localhost:8080`\n1. Using go run, just run this in terminal\n   ```\n   go run server.go\n   ```\n2. Using air (Install step 3), it will automatically hot reload your golang app, i found this the most comfortable way for developing process for me so far. Just type this to start\n   ```bash\n   air\n   ```\n3. Using go build, there are 2 steps :\n   1. Build the binary artifact\n      - Windows\n         ```\n         go build -o server.exe\n         ```\n      - Linux\n         ```\n         go build -o server\n         ```\n   2. Run the binary artifact\n4. Using Dockerfile, there are 2 steps :\n   1. Build docker image\n      ```\n      docker build --tag learn-gin:v0.1 .\n      ```\n   2. Run docker image as container (also expose port 8080 and detach mode)\n      ```\n      docker run -d -p 8080:8080 learn-gin:v0.1\n      ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffajarbc%2Flearn-gin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffajarbc%2Flearn-gin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffajarbc%2Flearn-gin/lists"}