{"id":22421322,"url":"https://github.com/joelmcdaniel/team-members","last_synced_at":"2026-05-09T10:39:56.903Z","repository":{"id":121888487,"uuid":"191494545","full_name":"joelmcdaniel/team-members","owner":"joelmcdaniel","description":"A Golang/MongoDB RESTful API coding challenge solution I whipped up for an interview that subsequently went nowhere. I think perhaps the interviewing company was looking for free solutions as is often the case.","archived":false,"fork":false,"pushed_at":"2020-05-28T21:18:27.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-01T10:24:38.362Z","etag":null,"topics":["gin","gin-gonic","go","golang","mongodb","mongodb-driver","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joelmcdaniel.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":"2019-06-12T03:58:55.000Z","updated_at":"2022-04-02T16:32:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"94fdeaaf-88ab-488f-8ad1-4a1e5b95b415","html_url":"https://github.com/joelmcdaniel/team-members","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/joelmcdaniel%2Fteam-members","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelmcdaniel%2Fteam-members/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelmcdaniel%2Fteam-members/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelmcdaniel%2Fteam-members/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joelmcdaniel","download_url":"https://codeload.github.com/joelmcdaniel/team-members/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245785813,"owners_count":20671634,"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","mongodb","mongodb-driver","rest-api"],"created_at":"2024-12-05T17:06:46.589Z","updated_at":"2026-05-09T10:39:51.871Z","avatar_url":"https://github.com/joelmcdaniel.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Team-Members\nTeam-Members is a back-end application that helps organizations manage their teams. It consists of a Go RESTful API app and uses [MongoDb](https://www.mongodb.com/) for the database. The [Gin Web Framework](https://github.com/gin-gonic/gin) package is used for HTTP routing and the [MongoDB Go Driver](https://github.com/mongodb/mongo-go-driver) package is used to connect and work with MongoDB.\n\n# Features and Requirements\n\n- A member has a name and a type. The member type can be an employee or a contractor - if it's a contractor, the duration of the contract needs to be saved and if it's an employee we need to store their role, for instance: Software Engineer, Project Manager and so on.\n\n- A member can be tagged, for instance: C#, Angular, General Frontend, Seasoned Leader and so on. (Tags will likely be used as filters later, so keep that in mind)\n\nA RESTful CRUD is offered for the information above.\n\n# Installation\n#### 1. Install Go\nFollow the instructions here: https://golang.org/doc/install\n\n#### 2. Install MongoDB\nFollow the instructions here: https://docs.mongodb.com/manual/installation/\n\n#### 3. Install Gin package\n```bash\ngo get -u github.com/gin-gonic/gin\n```\n#### 4. Install the MongoDB Go Driver package\n```bash\ngo get github.com/mongodb/mongo-go-driver\n```\nNOTE: The output of this may look like a warning stating something like package `github.com/mongodb/mongo-go-driver`: no Go files in (...). This is expected output.\n\n#### 5. Install [gotoenv](https://github.com/subosito/gotenv) package\n```bash\ngo get github.com/subosito/gotenv\n```\n\n#### 6. Install Team-Members\nCopy team-members directory to /go/src\n\n\nNOTE: Examples shown here below use the default configuration settings avaiable in the .env file under team-members directory. Feel free to change the settings to your preferred configuration settings:\n\n```bash\n    MONGODB=mongodb://localhost:27017\n    DB_NAME=members\n\n    #PORT=8080\n```\nPORT environment variable is for the Gin engine and if not set team-members/main.go will default it to \"8080\"\n\n\n## To Run\n1. Start MongoDB\n    ```bash\n    sudo mongod\n    ```\n3. Build team-members. From /go/src/team-members run\n    ```bash\n    go build\n    ```\n4. Run team-membrers. From /go/src/team-members run \n    ```bash\n    go run team-members\n    ```\n\n## Usage and Workflow\n#### NOTE: I highly recommend using [Postman](https://www.getpostman.com/) to work with and test Team-Members RESTful API Golang/MongoDB app.\n1. #### Create member\n    The payload data to create new employee and contractor members through a POST request will be the following JSON data structures respectively:\n\n    Employee:\n    ```json\n    {\n        \"oid\": null,\n        \"name\": \"Joel McDaniel\",\n        \"type\": {\n            \"key\": 1,\n            \"value\": \"Employee\",\n            \"properties\": {\n                \"role\": \"Senior Golang Engineer\"\n            }\n        },\n        \"tags\": [\n            \"Go\",\n            \"Golang\",\n            \"MongoDB\"\n        ]\n    }\n    ```\n\n    Contractor:\n    ```json\n    {\n        \"oid\": null,\n        \"name\": \"Someone Else\",\n        \"type\": {\n            \"key\": 0,\n            \"value\": \"Contractor\",\n            \"properties\": {\n                \"duration\": \"6 months\"\n            }\n        },\n        \"tags\": [\n            \"JavaScript\",\n            \"HTML5/CSS3\",\n            \"Vue.js\"\n        ]\n    }\n    ``` \n    \n    NOTE: For your convenience the above JSON data can be also be found under the team-members directory in the create_member_payload_data.json file.\n\n    Using Postman (or some similar tool) use the member json data structures above for the body of the POST request to be posted as raw JSON.\n    \n    To create a new member in the database POST the new member JSON to /api/member like so: \n\n        POST: http://localhost:8080/api/member\n\n    For the first member, this will create the mongodb \"members\" database and insert the document record.\n\n2. #### Read all members\n    To read the collection of members inserted into the \"members\" database use Postman to make a GET request to the same URI as above like so:\n\n        GET: http://localhost:8080/api/members\n\n    \n    The existing members collection response will be returned as JSON and each members' oid property value will be set to the document record ObjectID string value. This is the unique primary key value MongoDB generated during the inserts represented as the _id field in the \"members\" database. This value will be used in the request URI to fetch individual members as shown later below in section 4.\n\n    ```json\n    [\n        {\n            \"oid\": \"5ce9f998527c85b1d5a930f1\",\n            \"name\": \"Joel McDaniel\",\n            \"type\": {\n                \"key\": 1,\n                \"value\": \"Employee\",\n                \"properties\": {\n                    \"role\": \"Senior Golang Engineer\"\n                }\n            },\n            \"tags\": [\n                \"Go\",\n                \"Golang\",\n                \"MongoDB\"\n            ]\n        },\n        {\n            \"oid\": \"5ce9f9c4527c85b1d5a930f2\",\n            \"name\": \"Someone Else\",\n            \"type\": {\n                \"key\": 0,\n                \"value\": \"Contractor\",\n                \"properties\": {\n                    \"duration\": \"6 months\"\n                }\n            },\n            \"tags\": [\n                \"JavaScript\",\n                \"HTML5/CSS3\",\n                \"Vue.js\"\n            ]\n        }\n    ] \n    ```\n3. #### Read members by tags\n    To read members filtered by tags make a get request to /api/members/?tags=`\u003ctag\u003e`\u0026tags=`\u003ctag\u003e` ect. appending /? and tags querystring parameter for each tag you wish to filter on like so:\n\n            GET: http://localhost:8080/api/members/?tags=Meowin\u0026tags=Hunting\u0026tags=Go\n\n    This will return members corresponding to the tags filtered on from the request URI querystring:\n\n    ```json\n    {\n        \"oid\": \"5ce9f998527c85b1d5a930f1\",\n        \"name\": \"Joel McDaniel\",\n        \"type\": {\n            \"key\": 1,\n            \"value\": \"Employee\",\n            \"properties\": {\n                \"role\": \"Senior Golang Engineer\"\n            }\n        },\n        \"tags\": [\n            \"Go\",\n            \"Golang\",\n            \"MongoDB\"\n        ]\n    },\n    {\n        \"oid\": \"5cec7a92fc1f14ada5542358\",\n        \"name\": \"Franz Wooleybear\",\n        \"type\": {\n            \"key\": 1,\n            \"value\": \"Employee\",\n            \"properties\": {\n                \"role\": \"Señor Kitty Cat\"\n            }\n        },\n        \"tags\": [\n            \"Meowin\",\n            \"Loungin\",\n            \"Hunting\"\n        ]\n    }\n    ```\n\n4. #### Read member\n\n    By ObjectID:\n\n    To read individual existing members by ObjectID use Postman to make a GET request to /api/member/oid/:oid appending the oid string value to the URI endpoint path like so:\n\n            GET: http://localhost:8080/api/member/oid/5ce9f998527c85b1d5a930f1\n\n    This will return the member corresponding to the string ObjectID (:oid):\n\n    ```json\n    {\n        \"oid\": \"5ce9f998527c85b1d5a930f1\",\n        \"name\": \"Joel McDaniel\",\n        \"type\": {\n            \"key\": 1,\n            \"value\": \"Employee\",\n            \"properties\": {\n                \"role\": \"Senior Golang Engineer\"\n            }\n        },\n        \"tags\": [\n            \"Go\",\n            \"Golang\",\n            \"MongoDB\"\n        ]\n    }\n    ```\n    By Name:\n\n    To read individual existing members by Name use Postman to make a GET request to /api/member/name/:name appending the name string value to the URI endpoint path like so:\n\n            GET: http://localhost:8080/api/member/name/Franz Wooleybear\n\n    This will return the member corresponding to the string name (:name):\n\n    ```json\n    {\n        \"oid\": \"5cec7a92fc1f14ada5542358\",\n        \"name\": \"Franz Wooleybear\",\n        \"type\": {\n            \"key\": 1,\n            \"value\": \"Employee\",\n            \"properties\": {\n                \"role\": \"Señor Kitty Cat\"\n            }\n        },\n        \"tags\": [\n            \"Meowin\",\n            \"Loungin\",\n            \"Hunting\"\n        ]\n    }\n    ```\n\n\n5. #### Update member\n    To update a member use Postman with the JSON member data from a GET request (including oid value) for the body of the PUT request as raw JSON making any changes to the data before sending the request.\n    \n    ```json\n    {\n        \"oid\": \"5ce9f9c4527c85b1d5a930f2\",\n        \"name\": \"Someone Else\",\n        \"type\": {\n            \"key\": 1,\n            \"value\": \"Employee\",\n            \"properties\": {\n                \"role\": \"Front-end Developer\"\n            }\n        },\n        \"tags\": [\n            \"JavaScript\",\n            \"HTML5/CSS3\",\n            \"Vue.js\"\n        ]\n    }\n    ```\n\n     Make the PUT request to /api/member/:oid with the oid string value appended to the URI endpoint path like so:\n\n        PUT: http://localhost:8080/api/member/5ce9f9c4527c85b1d5a930f2\n\n    Make another GET request at the same URI to verify/return the updated document record.\n\n6. #### Delete member\n    To delete a member use Postman to make a DELETE request to /api/member/:oid with the oid string value appended to the URI endpoint path like so:\n\n        DELETE: http://localhost:8080/api/member/5ce9f9c4527c85b1d5a930f2\n\n    Make another GET all members request to verify the member was removed from the collection.\n\n## Hope you enjoyed!\n\n    \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoelmcdaniel%2Fteam-members","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoelmcdaniel%2Fteam-members","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoelmcdaniel%2Fteam-members/lists"}