{"id":15916094,"url":"https://github.com/dmuhs/url-shortener","last_synced_at":"2025-04-03T05:22:47.334Z","repository":{"id":86680160,"uuid":"145022973","full_name":"dmuhs/url-shortener","owner":"dmuhs","description":"A simple Go url shortener API built to learn Go","archived":false,"fork":false,"pushed_at":"2018-08-16T18:09:28.000Z","size":4849,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T19:24:44.264Z","etag":null,"topics":["golang","rest-api","sqlite3","url-shortener"],"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/dmuhs.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":"2018-08-16T18:04:57.000Z","updated_at":"2024-12-24T19:13:28.000Z","dependencies_parsed_at":"2023-03-06T11:00:19.245Z","dependency_job_id":null,"html_url":"https://github.com/dmuhs/url-shortener","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"38c3ccbb2717eb9a61d2ebeb3a1efdf1caf46a2b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuhs%2Furl-shortener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuhs%2Furl-shortener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuhs%2Furl-shortener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuhs%2Furl-shortener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmuhs","download_url":"https://codeload.github.com/dmuhs/url-shortener/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246940336,"owners_count":20858114,"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":["golang","rest-api","sqlite3","url-shortener"],"created_at":"2024-10-06T18:00:58.788Z","updated_at":"2025-04-03T05:22:47.303Z","avatar_url":"https://github.com/dmuhs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A simple Go URL Shortener\n\nThis is a simple URL shortening API that I built without any previous experience in Go. Built with ♥ in a solid day of hacking.\n\n## Features\n- centralized JSON configuration file (accessible as middleware by request handlers)\n- same short code served for the same links submitted\n- SQLite integration\n\n## Deployment\nSimply run `make build` to rebuild the application and automatically install required dependencies. To run it, just run `make run` in the project root directory.\n\n## Endpoints\n### `/`\n#### GET\nDisplay the number of rows in the table (i.e. the number of link to short code combinations)\n\n#### POST\nSubmit a new URL to be shortened by the API. This will take a JSON object in the request body with the format:\n```json\n{\n  \"url\": \"http://dmuhs.com\"\n}\n```\nand yield a response\n```json\n{\n    \"LongURL\": \"http://dmuhs.com/\",\n    \"ShortURL\": \"http://my-shortener.com:8000/ByH81bL0\"\n}\n```\n\n### `/{code}`\n#### GET\nDelivers a 302 permanent redirect response towards the URL associated with the short code in the database.\n\n\n## Configuration\nConfiguration is handled through a JSON file in `url-shortener/config.json`.\n```json\n{\n  \"SQLitePath\": \"./urls.db\",\n  \"Port\": 8000,\n  \"ShortCodeLength\": 8,\n  \"Domain\": \"http://my-shortener.com\",\n  \"Public\": true\n}\n```\n\nHere the `Public` key toggles whether the service is accessible from hosts other than `localhost`. The `shortCodeLength` property defines the length of the generated short codes, which are randomly chosen from the charset `a-zA-Z0-9`. The `Domain` property decides which domain is used by the shortener's response, e.g. `http://my-shortener.com:8000/ByH81bL0` for the above example configuration. To be able to directly follow links in a local deployment, it can also be set to `http://localhost`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmuhs%2Furl-shortener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmuhs%2Furl-shortener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmuhs%2Furl-shortener/lists"}