{"id":18977571,"url":"https://github.com/evgeniy-dammer/urlshortener","last_synced_at":"2025-09-15T02:34:25.105Z","repository":{"id":135175410,"uuid":"481587204","full_name":"evgeniy-dammer/urlshortener","owner":"evgeniy-dammer","description":"\"URL Shortener\" exercise from Gophercises (by John Calhoun)","archived":false,"fork":false,"pushed_at":"2022-04-14T11:58:22.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-02T14:59:32.859Z","etag":null,"topics":["go","golang","gophercises","url-shortener","urlshortener"],"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/evgeniy-dammer.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":"2022-04-14T11:58:19.000Z","updated_at":"2022-04-15T08:26:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"c7cfefd6-fbd6-4586-85fd-4bc3cd72256e","html_url":"https://github.com/evgeniy-dammer/urlshortener","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/evgeniy-dammer/urlshortener","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evgeniy-dammer%2Furlshortener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evgeniy-dammer%2Furlshortener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evgeniy-dammer%2Furlshortener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evgeniy-dammer%2Furlshortener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evgeniy-dammer","download_url":"https://codeload.github.com/evgeniy-dammer/urlshortener/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evgeniy-dammer%2Furlshortener/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275195069,"owners_count":25421701,"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","status":"online","status_checked_at":"2025-09-15T02:00:09.272Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["go","golang","gophercises","url-shortener","urlshortener"],"created_at":"2024-11-08T15:29:39.480Z","updated_at":"2025-09-15T02:34:25.067Z","avatar_url":"https://github.com/evgeniy-dammer.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \"URL Shortener\" exercise from Gophercises (by Jon Calhoun)\n\nWebsite: https://gophercises.com\n\nGitHub: https://github.com/gophercises\n\nYouTube: https://www.youtube.com/playlist?list=PLVEltXlEeWglGINo25GxVfvSSylLVg4r1\n\n## Task\nThe goal of this exercise is to create an `http.Handler` that will look at the path of any incoming web request and determine if it should redirect the user to a new page, much like URL shortener would.\n\nFor instance, if we have a redirect setup for `/dogs` to `https://www.somesite.com/a-story-about-dogs` we would look for any incoming web requests with the path `/dogs` and redirect them.\n\nTo complete this exercises you will need to implement the stubbed out methods in `handler.go`. There are a good bit of comments explaining what each method should do, and there is also a `main.go` source file that uses the package to help you test your code and get an idea of what your program should be doing.\n\nFocus on parsing the YAML using the [gopkg.in/yaml.v2](https://godoc.org/gopkg.in/yaml.v2) package. \n\nAfter you get the YAML parsing down, try to convert the data into a map and then use the MapHandler to finish the YAMLHandler implementation. Eg you might end up with some code like this:\n\n```go\nfunc YAMLHandler(yaml []byte, fallback http.Handler) (http.HandlerFunc, error) {\n  parsedYaml, err := parseYAML(yaml)\n  if err != nil {\n    return nil, err\n  }\n  pathMap := buildMap(parsedYaml)\n  return MapHandler(pathMap, fallback), nil\n}\n```\n\nBut in order for this to work you will need to create functions like `parseYAML` and `buildMap` on your own. This should give you ample experience working with YAML data.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevgeniy-dammer%2Furlshortener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevgeniy-dammer%2Furlshortener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevgeniy-dammer%2Furlshortener/lists"}