{"id":27183182,"url":"https://github.com/boreec/url-aliaser","last_synced_at":"2025-04-09T15:55:35.147Z","repository":{"id":152573389,"uuid":"626499194","full_name":"boreec/url-aliaser","owner":"boreec","description":"URL aliaser service written in Golang.","archived":false,"fork":false,"pushed_at":"2023-07-22T10:29:30.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-07-22T11:32:19.957Z","etag":null,"topics":["alias","go","golang","http","json","unit-testing","url-alias","url-shortener"],"latest_commit_sha":null,"homepage":"https://boreec.fr/projects","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boreec.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}},"created_at":"2023-04-11T15:32:12.000Z","updated_at":"2023-07-22T11:32:26.851Z","dependencies_parsed_at":"2023-07-22T11:46:01.863Z","dependency_job_id":null,"html_url":"https://github.com/boreec/url-aliaser","commit_stats":null,"previous_names":["boreec/url-aliaser"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boreec%2Furl-aliaser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boreec%2Furl-aliaser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boreec%2Furl-aliaser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boreec%2Furl-aliaser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boreec","download_url":"https://codeload.github.com/boreec/url-aliaser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065115,"owners_count":21041867,"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":["alias","go","golang","http","json","unit-testing","url-alias","url-shortener"],"created_at":"2025-04-09T15:55:33.935Z","updated_at":"2025-04-09T15:55:35.142Z","avatar_url":"https://github.com/boreec.png","language":"Go","readme":"# url-aliaser by Cyprien Borée\n\nThis application serves as a user-friendly URL aliasing server. Users can \nprovide long URLs, and the server generates shortened aliases that redirect to \nthe original URLs. The aliases act as convenient shortcuts for accessing the \noriginal links.\n\n# Setup\n\n## Building the server\n\nTo get started, follow these steps to build the url-aliaser server:\n\n1. Clone the repository and navigate to the cloned directory.\n2. Build the application using the `go` command:\n\n```bash\ngo build ./...\n```\n\nUpon successful compilation, you'll find a new executable named `url-aliaser` \nin the current directory.\n\n## Running Unit Tests (Optional)\n\nYou can run unit tests to ensure the application functions correctly. Use the \nfollowing command to execute the tests:\n\n```bash\ngo test ./...\n```\n\n# Usage\n\nThe URLAliaser server runs by default on  `http://localhost:8080`.\n\nTo create a shortened alias, make a POST request to the `/alias`` endpoint with \na JSON payload. The payload must adhere to the following structure:\n\n```json\n{\n    \"url\" : \"https://example.com\",\n    \"length\" : 10\n}\n```\n\n- `url`: The original link you want to shorten (required).\n- `length`: The desired maximum length of the shortened alias (required).\n\nThe server will store the provided URL, generate a new alias, and respond with \nthe following JSON payload:\n\n```json\n{\n    \"url\" : \"http://localhost:8080/xxxx\"\n}\n```\n- `url`: The shortened alias, where `xxxx` is a randomly generated string \nmatching the requested length.\n\n## example with Curl\n\nIn the following command, replace `https://example.com` with the url you wish to alias.\n\n```bash\n$ curl -X POST -H \"Content-Type: application/json\" -d '{\"url\": \"https://example.com\", \"length\":10}' http://localhost:8080/alias\n{\"url\":\"http://localhost:8080/100680ad54\"}\n```\n\nAfter this command, you can use `http://localhost:8080/100680ad54` as a \nredirection to `https://example.com`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboreec%2Furl-aliaser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboreec%2Furl-aliaser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboreec%2Furl-aliaser/lists"}