{"id":22695723,"url":"https://github.com/gugutz/stairs-backend-challenge","last_synced_at":"2025-03-29T18:09:50.537Z","repository":{"id":48500110,"uuid":"209991993","full_name":"gugutz/stairs-backend-challenge","owner":"gugutz","description":"Backend Challenge for Stairs Studio, written in Go.","archived":false,"fork":false,"pushed_at":"2021-07-22T16:36:47.000Z","size":19,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-04T18:50:50.937Z","etag":null,"topics":[],"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/gugutz.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}},"created_at":"2019-09-21T13:42:26.000Z","updated_at":"2019-09-23T06:44:09.000Z","dependencies_parsed_at":"2022-09-19T06:40:16.314Z","dependency_job_id":null,"html_url":"https://github.com/gugutz/stairs-backend-challenge","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/gugutz%2Fstairs-backend-challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gugutz%2Fstairs-backend-challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gugutz%2Fstairs-backend-challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gugutz%2Fstairs-backend-challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gugutz","download_url":"https://codeload.github.com/gugutz/stairs-backend-challenge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246223319,"owners_count":20743165,"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":[],"created_at":"2024-12-10T04:11:43.555Z","updated_at":"2025-03-29T18:09:50.519Z","avatar_url":"https://github.com/gugutz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stairs Backend Challenge\n\nThis is my solution for the Stairs Backend Challenge.\n\nWritten in Go, using MongoDB and Go Modules mode. \n\n\n## Install and Run\n\nThis API uses [Go](http://golang.org) and [MongoDB](https://mongodb.com).\n\nThe MongoDB is instanced using [Docker Compose](https://github.com/docker/compose). \n\n### Setting up the Database\nThe MongoDB is instanced using docker-compose. \n\nNavigate to the API folder and raise the database with:\n```sh\n$ docker-compose-up\n```\n\n### Creating the database and a collection\n\nOnce MongoDB is up, you must create a database and a collection. \nThis setup also raises a **Mongo Express** instance to make this easier.\n\nThe address to the Mongo Express configuration page is: **`localhost:8081`**\n\n### Updating the configuration file\n\nAfter creating the database and the collection, open the `config.toml` file in the root folder and update the fields to match the name of the database and the collection you created.\n\n### Run the API \nAfter raising the database instance, run the API:\n```sh\n$ go run main.go\n```\n\n## API Description\n\nThis is a REST API made with Go that exposes 5 endpoints:\n\n\u003chr\u003e\n\u003cdiv style=\"background-color: #faf7f1\"\u003e\n\u003cdiv style=\"width: auto; height: 35px; background: #dffed8\"\u003e\n\u003ccode style=\"display: inline-block; width: 70px; position: relative; top: 3px;font-size: 15px;font-weight: bolder; background-color: lightgreen; color: black; margin-left: 7px; padding: 3px 17px;\"\u003e\nPOST\n\u003c/code\u003e\n\u003ccode style=\"font-size: 15px;background:inherit; position: relative; top: 4px;\"\u003e\n/wines\n\u003c/code\u003e\n\u003cspan style=\"font-size: 13px;background:inherit; position: relative; top: 4px;\"\u003e\nGet all wines\n\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\n*Parameters:* \n```\nNo parameters\n```\n\n\u003chr\u003e\n\n\u003cdiv style=\"width: auto; height: 35px; background: #e2f3fc\"\u003e\n\u003ccode style=\"width: 70px; display: inline-block; position: relative; top: 3px;font-size: 15px;font-weight: bolder; background-color: #78cffe; color: black; margin-left: 7px; padding: 3px 20px;\"\u003e\nGET\n\u003c/code\u003e\n\u003ccode style=\"font-size: 15px;background:inherit; position: relative; top: 4px;\"\u003e\n/wines\n\u003c/code\u003e\n\u003cspan style=\"font-size: 13px;background:inherit; position: relative; top: 4px;\"\u003e\nGet all wines\n\u003c/span\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\n*Parameters:* \n\n```\nNo parameters\n```\n\n\u003chr\u003e\n\n\u003cdiv style=\"width: auto; height: 35px; background: #dffed8\"\u003e\n\u003ccode style=\"display: inline-block; width: 70px; position: relative; top: 3px;font-size: 15px;font-weight: bolder; background-color: lightgreen; color: black; margin-left: 7px; padding: 3px 17px;\"\u003e\nPOST\u003c/code\u003e\n\u003ccode style=\"font-size: 15px;background:inherit; position: relative; top: 4px;\"\u003e\n/wines/new\n\u003c/code\u003e\n\u003cspan style=\"font-size: 13px;background:inherit; position: relative; top: 4px;\"\u003e\nAdd wines\n\u003c/span\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\n*Parameters:* \n\n\u003ctable style=\"font-size: 13px;border: none\" cellspacing=\"0\" cellpadding=\"0\"\u003e\n\u003ctr\u003e\n\u003ctd\u003e\nname\u003c/td\u003e\u003ctd\u003e string\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eharvest\u003c/td\u003e\u003ctd\u003einteger\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003ecountry\u003c/td\u003e\u003ctd\u003estring\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eamount\u003c/td\u003e\u003ctd\u003eint\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003edescription\u003c/td\u003e\u003ctd\u003estring\u003c/td\u003e \n\u003c/tr\u003e\n\u003c/table\u003e\n\n\n*Usage Example:*\n\n```json\n{\n  \"name\": \"Petrus\",\n  \"harvest\": 1984,\n  \"country\": \"France\",\n  \"ammount\": 0,\n  \"description\": \"This wine comes from the regions of...\"\n}\n```\n\n\u003cdiv style=\"clear:both\"\u003e\nNOTE: MongoDB adds the ObjectID automatically if its not specified\n\u003c/div\u003e\n\n\u003chr\u003e\n\n\u003cdiv style=\"clear: both;width: auto; height: 35px; background: #fae3b7\"\u003e\n\u003ccode style=\"width: 70px; display: inline-block; position: relative; top: 3.5px;font-size: 15px;font-weight: bolder; background-color: #f2ab2e; color: black; margin-left: 7px; padding: 3px 21px;\"\u003e\nPUT\u003c/code\u003e\n\u003ccode style=\"font-size: 15px;background:inherit; position: relative; top: 4px;\"\u003e\n/wines/{id}\n\u003c/code\u003e\n\u003cspan style=\"font-size: 13px;background:inherit; position: relative; top: 4px;\"\u003e\nUpdate a wine\n\u003c/span\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\n*Parameters:* \n\n\u003ctable style=\"font-size: 13px;border: none\" cellspacing=\"0\" cellpadding=\"0\"\u003e\n\u003ctr\u003e\n\u003ctd\u003eid\u003c/td\u003e\u003ctd\u003eint\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003ewine\u003c/td\u003e\u003ctd\u003eStruct\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\n*Usage Example:*\n\n```json\n{\n  \"id\": \"5d881cf1d663f81498131a81\",\n  \"wine\": {\n    \"name\": \"New Name\",\n    \"harvest\": 2005,\n    \"country\": \"New Country\",\n    \"ammount\": 0,\n    \"description\": \"New description for the wine...\"\n  }\n}\n```\n\n\u003chr\u003e\n\u003cdiv style=\"width: auto; height: 35px; background: #fce2e2\"\u003e\n\u003ccode style=\"width: 80px; display: inline-block; position: relative; top: 3.5px;font-size: 15px;font-weight: bolder; background-color: #fa5353; color: black; margin-left: 7px; padding: 3px 12px;\"\u003e\nDELETE\u003c/code\u003e\n\u003ccode style=\"font-size: 15px;background:inherit; position: relative; top: 4px;\"\u003e\n/wines/{id}\n\u003c/code\u003e\n\u003cspan style=\"font-size: 13px;background:inherit; position: relative; top: 4px;\"\u003e\nDeletes a wine\n\u003c/span\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\n*Parameters:* \n\n\u003ctable style=\"font-size: 13px;border: none\" cellspacing=\"0\" cellpadding=\"0\"\u003e\n\u003ctr\u003e\n\u003ctd\u003eid\u003c/td\u003e\u003ctd\u003eint\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\u003cbr\u003e\n\n\u003chr\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgugutz%2Fstairs-backend-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgugutz%2Fstairs-backend-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgugutz%2Fstairs-backend-challenge/lists"}