{"id":20305967,"url":"https://github.com/dedidot/simple-api-golang","last_synced_at":"2025-04-11T15:01:50.382Z","repository":{"id":144266087,"uuid":"116539799","full_name":"dedidot/simple-api-golang","owner":"dedidot","description":"Golang simple api with Mux and Gorm","archived":false,"fork":false,"pushed_at":"2018-01-13T04:13:17.000Z","size":5,"stargazers_count":10,"open_issues_count":1,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T11:04:02.536Z","etag":null,"topics":["go","golang","gorm","restful-api","simple-api","tutorial"],"latest_commit_sha":null,"homepage":null,"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/dedidot.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":"2018-01-07T05:19:34.000Z","updated_at":"2023-10-30T21:32:01.000Z","dependencies_parsed_at":"2023-07-05T00:01:19.468Z","dependency_job_id":null,"html_url":"https://github.com/dedidot/simple-api-golang","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/dedidot%2Fsimple-api-golang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedidot%2Fsimple-api-golang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedidot%2Fsimple-api-golang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedidot%2Fsimple-api-golang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dedidot","download_url":"https://codeload.github.com/dedidot/simple-api-golang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248428526,"owners_count":21101774,"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","gorm","restful-api","simple-api","tutorial"],"created_at":"2024-11-14T17:11:05.453Z","updated_at":"2025-04-11T15:01:50.364Z","avatar_url":"https://github.com/dedidot.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Api with Go\nIt is a just simple RESTful API with Go using:\n1. **gorilla/mux**\n2. **gorm** \n\n## Installation \u0026 Run\n```bash\n# Download this project\n$ go get github.com/dedidot/simple-api-golang\n\n# Download Mux Router\n$ go get github.com/gorilla/mux\n\n# Download GORM\n$ go get github.com/jinzhu/gorm\n\n# Download stringer / generate random id\n$ go get github.com/dedidot/generate/stringer\n```\n\nSetting DB in config/database.go\n```go\nfunc GetConfig() *Config {\n\treturn \u0026Config{\n\t\tDB: \u0026DBConfig{\n\t\t\tDialect:  \"mysql\",\n\t\t\tUsername: \"root\",\n\t\t\tPassword: \"\",\n\t\t\tName:     \"testinger\",\n\t\t\tCharset:  \"utf8\",\n\t\t},\n\t}\n}\n```\n\n```bash\n# Build and Run\ncd simple-api-golang\ngo build\n./simple-api-golang\n\n# API Endpoint : http://127.0.0.1:8000\n```\n\n## Structure\n```\n├── app\n│   ├── routes.go                   // Router\n│   ├── controllers                 // Our API core handlers\n│   │   ├── ActionPostBook.go       \n│   │   ├── ActionViewBook.go       \n│   └── models\n│   |   └── book.go     // APi Model\n|   └── utils\n|       └── utils.go // generate id\n├── config\n│   └── database.go        // Configuration\n├── migrate\n|   └── book.go // Models for our application\n└── main.go\n```\n\n## API\n\n#### /book\n* `GET` : Get all book\n* `POST` : Create a new book\n\n#### /book/:codes\n* `GET` : Get a book\n* `PUT` : Update a book\n* `DELETE` : Delete a book\n\n#Post Params\n```\n{\n\t\"author\": \"Op Super John Doe Bilw\",\n\t\"name\": \"Implementation Golang\",\n\t\"category\": \"Knowledge\"\n}\n```\n\n```bash\n# Inspired By\ngithub.com/mingrammer/go-todo-rest-api-example\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdedidot%2Fsimple-api-golang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdedidot%2Fsimple-api-golang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdedidot%2Fsimple-api-golang/lists"}