{"id":37137290,"url":"https://github.com/culdo/bbs-restful-api","last_synced_at":"2026-01-14T15:59:57.465Z","repository":{"id":133861551,"uuid":"473609415","full_name":"culdo/bbs-restful-api","owner":"culdo","description":"留言板RESTful API","archived":false,"fork":false,"pushed_at":"2022-04-28T06:05:28.000Z","size":149,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-20T11:51:04.102Z","etag":null,"topics":["golang","rest-api"],"latest_commit_sha":null,"homepage":"https://bbs-restful-api.herokuapp.com/","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/culdo.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}},"created_at":"2022-03-24T13:05:20.000Z","updated_at":"2022-04-22T09:32:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2b42d5f-a2f0-477a-b503-571da4b76577","html_url":"https://github.com/culdo/bbs-restful-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/culdo/bbs-restful-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/culdo%2Fbbs-restful-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/culdo%2Fbbs-restful-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/culdo%2Fbbs-restful-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/culdo%2Fbbs-restful-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/culdo","download_url":"https://codeload.github.com/culdo/bbs-restful-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/culdo%2Fbbs-restful-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28425596,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T15:24:48.085Z","status":"ssl_error","status_checked_at":"2026-01-14T15:23:41.940Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["golang","rest-api"],"created_at":"2026-01-14T15:59:55.150Z","updated_at":"2026-01-14T15:59:57.450Z","avatar_url":"https://github.com/culdo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BBS RESTful API\nTry it on [bbs-restful-api.herokuapp.com](https://bbs-restful-api.herokuapp.com/)\n# Dependencies\n* gin\n* gorm\n* gin-sessions\n# 功能\n* `GET /posts`: 瀏覽目前的留言(不包含隱藏留言，預設30筆)\n* `GET /register`: 註冊帳號\n* `GET /login`: 登入帳號\n## 使用者\n* `POST /posts`: 創建留言\n* `POST /posts/:id/comments`: 回覆特定留言\n## 管理員\n* `GET /admin/posts`: 瀏覽目前的留言(包含隱藏留言，預設30筆)\n* `GET /admin/posts/search`: 搜尋留言內容\n* `PATCH /admin/posts/:id`: 隱藏/顯示特定留言\n* `PATCH /admin/users/:id`:停權/解封特定使用者\n# Developing\n```bash\n# You need to create a db user if you have't one\nsudo -u postgres createuser -s \u003cusername\u003e\n\nexport DATABASE_URL=\"your_postgredb_url\"\nexport SESSION_KEY=\"session_store_secret_you_want\"\nexport ADMIN_PASSWD=\"bbs_admin_password_you_want\"\ngo run main.go\n```\n# Testing\n```bash\n# You need to create a test db if you have't one\nsudo -u postgres createdb bbstest\ngo test -count=1 ./...\n```\n# Testing with GitHub Action\nCheck out `.github/workflows/main.yaml` to see how it works\n# Depoly on Heroku\nSet `DATABASE_URL`, `SESSION_KEY` and `ADMIN_PASSWD` as your app's `Config Vars`\n# cURL examples\n## 使用者\n### 取得所有留言(不包含隱藏留言)\n```bash\ncurl -i -X GET -H 'Content-Type: application/json' bbs-restful-api.herokuapp.com/posts\n```\n### 註冊\n```bash\ncurl -i -X POST -d '{\"username\":\"test_login\",\"password\":\"test_password\"}' -H 'Content-Type: application/json' bbs-restful-api.herokuapp.com/register\n```\n### 登入\n```bash\ncookie=$(curl -i -X POST -d '{\"username\":\"test_login\",\"password\":\"test_password\"}' -H 'Content-Type: application/json' bbs-restful-api.herokuapp.com/login | grep -Po '(?\u003c=Set-Cookie: ).+(?=\\r)')\n```\n### 發布留言\n```bash\ncurl -i -X POST -d '{\"title\":\"test_title2\",\"content\":\"test_content2\"}' --cookie \"$cookie\" -H 'Content-Type: application/json' bbs-restful-api.herokuapp.com/posts\n```\n### 回覆留言(id = 2)\n```bash\ncurl -i -X POST -d '{\"content\":\"test_comment\"}' --cookie \"$cookie\" -H 'Content-Type: application/json' bbs-restful-api.herokuapp.com/posts/2/comments\n```\n\n## 管理員\n### 登入\n```bash\nadmin_cookie=$(curl -i -X POST -d '{\"username\":\"admin\",\"password\":'\"\\\"$ADMIN_PASSWD\\\"\"'}' -H 'Content-Type: application/json' bbs-restful-api.herokuapp.com/login | grep -Po '(?\u003c=Set-Cookie: ).+(?=\\r)')\n```\n### 停權使用者(id = 2)\n```bash\ncurl -i -X PATCH -d '{\"active\": false}' --cookie \"$admin_cookie\" -H 'Content-Type: application/json' bbs-restful-api.herokuapp.com/admin/users/2\n```\n### 解封使用者(id = 2)\n```bash\ncurl -i -X PATCH -d '{\"active\": true}' --cookie \"$admin_cookie\" -H 'Content-Type: application/json' bbs-restful-api.herokuapp.com/admin/users/2\n```\n### 隱藏留言(id = 2)\n```bash\ncurl -i -X PATCH -d '{\"hidden\": true}' --cookie \"$admin_cookie\" -H 'Content-Type: application/json' bbs-restful-api.herokuapp.com/admin/posts/2\n```\n### 顯示留言(id = 2)\n```bash\ncurl -i -X PATCH -d '{\"hidden\": false}' --cookie \"$admin_cookie\" -H 'Content-Type: application/json' bbs-restful-api.herokuapp.com/admin/posts/2\n```\n### 取得所有留言(包含隱藏留言)\n```bash\ncurl -i -X GET --cookie \"$admin_cookie\" -H 'Content-Type: application/json' bbs-restful-api.herokuapp.com/admin/posts\n```\n### 搜尋留言內容，回傳留言\n```bash\ncurl -i -X GET --cookie \"$admin_cookie\" -H 'Content-Type: application/json' bbs-restful-api.herokuapp.com/admin/posts/search?keyword=\"123\"\n```\n\n# To-do-list\n- [x] Use bcrypt on password accessing\n- [x] Deploy on cloud service\n- [x] Testing\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fculdo%2Fbbs-restful-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fculdo%2Fbbs-restful-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fculdo%2Fbbs-restful-api/lists"}