{"id":19078263,"url":"https://github.com/petronetto/echo-mongo-api","last_synced_at":"2025-04-30T04:46:42.349Z","repository":{"id":76827341,"uuid":"106360644","full_name":"petronetto/echo-mongo-api","owner":"petronetto","description":"Golang Echo's framework with Mongo database","archived":false,"fork":false,"pushed_at":"2017-10-10T02:57:45.000Z","size":7,"stargazers_count":12,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-30T04:46:34.385Z","etag":null,"topics":["docker","docker-compose","echo","go","golang","mongo","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/petronetto.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":"2017-10-10T02:49:49.000Z","updated_at":"2022-10-27T08:15:52.000Z","dependencies_parsed_at":"2023-03-01T06:45:19.020Z","dependency_job_id":null,"html_url":"https://github.com/petronetto/echo-mongo-api","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/petronetto%2Fecho-mongo-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petronetto%2Fecho-mongo-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petronetto%2Fecho-mongo-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petronetto%2Fecho-mongo-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petronetto","download_url":"https://codeload.github.com/petronetto/echo-mongo-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251644826,"owners_count":21620630,"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":["docker","docker-compose","echo","go","golang","mongo","rest-api"],"created_at":"2024-11-09T02:07:55.480Z","updated_at":"2025-04-30T04:46:42.327Z","avatar_url":"https://github.com/petronetto.png","language":"Go","readme":"# Golang API + Mongo database\n\n## Running\nRun `docker-compose up -d`  \n\n## Signup\nUser signup  \n\nRetrieve user credentials from the body and validate against database.\nFor invalid email or password, `send 400 - Bad Request` response.\nFor valid email and password, save user in database and send `201 - Created` response.  \n\nRequest  \n\n```sh\ncurl \\\n  -X POST \\\n  http://localhost:1323/signup \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"email\":\"jon@doe.com\",\"password\":\"secret\"}'\n```\nResponse  \n\n`201 - Created`  \n\n```json\n{\n  \"id\": \"58465b4ea6fe886d3215c6df\",\n  \"email\": \"jon@doe.com\",\n  \"password\": \"secret\"\n}\n```\n\n\n## Login\nUser login  \n\nRetrieve user credentials from the body and validate against database.\nFor invalid credentials, send 401 - Unauthorized response.\nFor valid credentials, send 200 - OK response:\nGenerate JWT for the user and send it as response.\nEach subsequent request must include JWT in the Authorization header.\nMethod: `POST`  \nPath: `/login`  \n\nRequest  \n\n```sh\ncurl \\\n  -X POST \\\n  http://localhost:1323/login \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"email\":\"jon@doe.com\",\"password\":\"secret\"}'\n```\nResponse  \n\n`200 - OK`\n\n```json\n{\n  \"id\": \"58465b4ea6fe886d3215c6df\",\n  \"email\": \"jon@doe.com\",\n  \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0ODEyNjUxMjgsImlkIjoiNTg0NjViNGVhNmZlODg2ZDMyMTVjNmRmIn0.1IsGGxko1qMCsKkJDQ1NfmrZ945XVC9uZpcvDnKwpL0\"\n}\n```\nClient should store the token, for browsers, you may use local storage.  \n\n\n\n## Follow\nFollow a user\n\nFor invalid token, send 400 - Bad Request response.\nFor valid token:\nIf user is not found, send 404 - Not Found response.\nAdd a follower to the specified user in the path parameter and send 200 - OK response.\nMethod: POST \nPath: /follow/:id\n\nRequest\n\n```sh\ncurl \\\n  -X POST \\\n  http://localhost:1323/follow/58465b4ea6fe886d3215c6df \\\n  -H \"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0ODEyNjUxMjgsImlkIjoiNTg0NjViNGVhNmZlODg2ZDMyMTVjNmRmIn0.1IsGGxko1qMCsKkJDQ1NfmrZ945XVC9uZpcvDnKwpL0\"\n```\nResponse\n\n`200 - OK`\n\n\n\n## Post\nPost a message to specified user  \n\nFor invalid request payload, send 400 - Bad Request response.\nIf user is not found, send 404 - Not Found response.\nOtherwise save post in the database and return it via 201 - Created response.\nMethod: `POST`  \nPath: `/posts`  \n\nRequest \n\n```sh\ncurl \\\n  -X POST \\\n  http://localhost:1323/posts \\\n  -H \"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0ODEyNjUxMjgsImlkIjoiNTg0NjViNGVhNmZlODg2ZDMyMTVjNmRmIn0.1IsGGxko1qMCsKkJDQ1NfmrZ945XVC9uZpcvDnKwpL0\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"to\":\"58465b4ea6fe886d3215c6df\",\"message\":\"hello\"}'\n```\nResponse  \n\n`201 - Created`\n\n```json\n{\n  \"id\": \"584661b9a6fe8871a3804cba\",\n  \"to\": \"58465b4ea6fe886d3215c6df\",\n  \"from\": \"58465b4ea6fe886d3215c6df\",\n  \"message\": \"hello\"\n}\n```\n\n\n## Feed\nList most recent messages based on optional page and limit query parameters   \n\nMethod: `GET`  \nPath: `/feed?page=1\u0026limit=5`  \n\nRequest  \n\n```sh\ncurl \\\n  -X GET \\\n  http://localhost:1323/feed \\\n  -H \"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0ODEyNjUxMjgsImlkIjoiNTg0NjViNGVhNmZlODg2ZDMyMTVjNmRmIn0.1IsGGxko1qMCsKkJDQ1NfmrZ945XVC9uZpcvDnKwpL0\"\n```\nResponse  \n\n`200 - OK`\n\n```json\n[\n  {\n    \"id\": \"584661b9a6fe8871a3804cba\",\n    \"to\": \"58465b4ea6fe886d3215c6df\",\n    \"from\": \"58465b4ea6fe886d3215c6df\",\n    \"message\": \"hello\"\n  }\n]\n```\n\n\n\n## License\n[BSD 3-Clause](https://github.com/petronetto/echo-mongo-api/blob/master/LICENSE)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetronetto%2Fecho-mongo-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetronetto%2Fecho-mongo-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetronetto%2Fecho-mongo-api/lists"}