{"id":34036878,"url":"https://github.com/rayou/cdk-url-shortener","last_synced_at":"2026-04-08T13:31:55.288Z","repository":{"id":37088726,"uuid":"291398581","full_name":"rayou/cdk-url-shortener","owner":"rayou","description":"Deploy a URL shortener with custom domain support in just a few lines of code.","archived":false,"fork":false,"pushed_at":"2023-01-26T13:05:27.000Z","size":285,"stargazers_count":14,"open_issues_count":5,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-15T12:46:13.832Z","etag":null,"topics":["aws","aws-cdk","aws-cdk-construct","cdk","serverless","url-shortener"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rayou.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-30T04:19:24.000Z","updated_at":"2024-08-05T09:28:38.000Z","dependencies_parsed_at":"2023-02-14T17:30:59.925Z","dependency_job_id":null,"html_url":"https://github.com/rayou/cdk-url-shortener","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/rayou/cdk-url-shortener","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayou%2Fcdk-url-shortener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayou%2Fcdk-url-shortener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayou%2Fcdk-url-shortener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayou%2Fcdk-url-shortener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rayou","download_url":"https://codeload.github.com/rayou/cdk-url-shortener/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayou%2Fcdk-url-shortener/sbom","scorecard":{"id":763682,"data":{"date":"2025-08-11","repo":{"name":"github.com/rayou/cdk-url-shortener","commit":"9ec0a70c66c8761694f9ff32057b71584e7461f5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/9 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/rayou/cdk-url-shortener/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/rayou/cdk-url-shortener/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:76: update your workflow using https://app.stepsecurity.io/secureworkflow/rayou/cdk-url-shortener/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:92: update your workflow using https://app.stepsecurity.io/secureworkflow/rayou/cdk-url-shortener/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/rayou/cdk-url-shortener/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/rayou/cdk-url-shortener/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/rayou/cdk-url-shortener/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/rayou/cdk-url-shortener/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/rayou/cdk-url-shortener/release.yml/master?enable=pin","Info:   0 out of   9 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":0,"reason":"47 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-rrc9-gqf8-8rwg","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-82v2-mx6x-wq7q","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc","Warn: Project is vulnerable to: GHSA-h6q6-9hqw-rwfv","Warn: Project is vulnerable to: GHSA-5fg8-2547-mr8q","Warn: Project is vulnerable to: GHSA-crh6-fp67-6883","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T00:08:44.818Z","repository_id":37088726,"created_at":"2025-08-23T00:08:44.818Z","updated_at":"2025-08-23T00:08:44.818Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31558380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T10:21:54.569Z","status":"ssl_error","status_checked_at":"2026-04-08T10:21:38.171Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["aws","aws-cdk","aws-cdk-construct","cdk","serverless","url-shortener"],"created_at":"2025-12-13T20:45:29.463Z","updated_at":"2026-04-08T13:31:55.279Z","avatar_url":"https://github.com/rayou.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/rayou"],"categories":[],"sub_categories":[],"readme":"# cdk-url-shortener \u003c!-- omit in toc --\u003e\n\n![Release](https://github.com/rayou/cdk-url-shortener/workflows/Release/badge.svg) [![npm](https://img.shields.io/npm/v/@rayou/cdk-url-shortener)](https://www.npmjs.com/package/@rayou/cdk-url-shortener) [![PyPI](https://img.shields.io/pypi/v/rayou.cdk_url_shortener)](https://pypi.org/project/rayou.cdk-url-shortener/) [![Maven Central](https://img.shields.io/maven-central/v/com.github.rayou/cdk-url-shortener)](https://search.maven.org/artifact/com.github.rayou/cdk-url-shortener) [![Nuget](https://img.shields.io/nuget/v/CDK.URLShortener)](https://www.nuget.org/packages/CDK.URLShortener/)\n\n\u003e Deploy a URL shortener with custom domain support in just a few lines of code.\n\n`cdk-url-shortener` is an AWS CDK L3 construct that will create a URL shortener with [custom domain](#custom-domain) support. The service uses [nanoid](https://github.com/ai/nanoid) to generate URL-friendly unique IDs and will retry if an ID collision occurs.\n\nAdditionally, you can enable [DynamoDB streams](#enable-dynamodb-streams) to capture changes to items stored in the DynamoDB table.\n\n**Table of Contents**\n\n- [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Basic](#basic)\n  - [Custom Domain](#custom-domain)\n  - [Multiple Custom Domains](#multiple-custom-domains)\n  - [Enable DynamoDB Streams](#enable-dynamodb-streams)\n- [Create your first short URL](#create-your-first-short-url)\n- [Documentation](#documentation)\n  - [Construct API Reference](#construct-api-reference)\n  - [URL Shortener API Endpoints](#url-shortener-api-endpoints)\n    - [Shorten a Link](#shorten-a-link)\n    - [Visit a shortened URL](#visit-a-shortened-url)\n- [Supporting this project](#supporting-this-project)\n- [License](#license)\n\n## Features\n\n- 🚀 Easy to Start - One-liner code to have your own URL shortener.\n- 🏢 Custom Domain - Bring your custom domain name that fits your brand.\n- 📡 DynamoDB Streams - Capture table activity with DynamoDB Streams.\n\n## Installation\n\nTypeScript/JavaScript\n\n```sh\n$ npm install @rayou/cdk-url-shortener\n```\n\nPython\n\n```sh\n$ pip install rayou.cdk-url-shortener\n```\n\n.Net\n\n```sh\n$ nuget install CDK.URLShortener\n\n# See more: https://www.nuget.org/packages/CDK.URLShortener/\n```\n\n## Usage\n\n### Basic\n\n```ts\nimport { URLShortener } from '@rayou/cdk-url-shortener';\n\nnew URLShortener(this, 'myURLShortener');\n```\n\n### Custom Domain\n\n```ts\nimport * as route53 from '@aws-cdk/aws-route53';\nimport * as acm from '@aws-cdk/aws-certificatemanager';\nimport { URLShortener } from '@rayou/cdk-url-shortener';\n\nconst zone = route53.HostedZone.fromLookup(this, 'HostedZone', {\n  domainName: 'mydomain.com',\n});\n\n// Optional, a DNS validated certificate will be created if not provided.\nconst certificate = acm.Certificate.fromCertificateArn(\n  this,\n  'Certificate',\n  'arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012',\n);\n\nnew URLShortener(this, 'myURLShortener').addDomainName({\n  domainName: 'foo.mydomain.com',\n  zone,\n  certificate,\n});\n```\n\n### Multiple Custom Domains\n\n```ts\nimport * as route53 from '@aws-cdk/aws-route53';\nimport { URLShortener } from '@rayou/cdk-url-shortener';\n\nconst zone = route53.HostedZone.fromLookup(this, 'HostedZone', {\n  domainName: 'mydomain.com',\n});\n\nnew URLShortener(this, 'myURLShortener')\n  .addDomainName({\n    domainName: 'foo.mydomain.com',\n    zone,\n  })\n  .addDomainName({\n    domainName: 'bar.mydomain.com',\n    zone,\n  });\n```\n\n⚠️ Please note that although we have added two custom domains, they are pointed to the same URL shortener instance sharing the same DynamoDB table, if you need both domains run independently, create a new URL shortener instance.\n\n### Enable DynamoDB Streams\n\n```ts\nimport * as lambda from '@aws-cdk/aws-lambda';\nimport * as dynamodb from '@aws-cdk/aws-dynamodb';\nimport * as lambdaEventSources from '@aws-cdk/aws-lambda-event-sources';\n\nimport { URLShortener } from '@rayou/cdk-url-shortener';\n\nconst table = new dynamodb.Table(this, 'Table', {\n  partitionKey: {\n    name: 'id',\n    type: dynamodb.AttributeType.STRING,\n  },\n  stream: dynamodb.StreamViewType.NEW_AND_OLD_IMAGES,\n});\n\nnew URLShortener(this, 'myURLShortener', {\n  dynamoTable: table,\n});\n\nconst streamHandlerCode = `'use strict';\n    exports.handler = async (event) =\u003e {\n      console.log('Received event:', JSON.stringify(event, null, 2));\n      for (const record of event.Records) {\n        console.log(record.eventID);\n        console.log(record.eventName);\n        console.log('DynamoDB Record: %j', record.dynamodb);\n      }\n      console.log(\\`Successfully processed \\${event.Records.length} records.\\`);\n    };`;\n\nconst lambdaFn = new lambda.Function(this, 'myStreamHandler', {\n  runtime: lambda.Runtime.NODEJS_12_X,\n  handler: 'index.handler',\n  code: lambda.Code.fromInline(streamHandlerCode),\n});\n\nlambdaFn.addEventSource(\n  new lambdaEventSources.DynamoEventSource(table, {\n    startingPosition: lambda.StartingPosition.LATEST,\n  }),\n);\n```\n\n## Create your first short URL\n\n1. After the deployment, you'll see `ApiKeyURL` and `ApiEndpoint` in CDK Outputs, visit `ApiKeyURL` to get your API key.\n\n   ```shell\n   Outputs:\n   stack.CustomDomainApiEndpointcc4157 = https://mydomain.com\n   stack.myURLShortenerApiEndpoint47185311 = https://yrzxcvbafk.execute-api.us-west-2.amazonaws.com/prod/\n   stack.ApiKeyURL = https://console.aws.amazon.com/apigateway/home?#/api-keys/k2zxcvbafw6\n   ```\n\n2. Run this cURL command to create your first short URL, an `ID` will be returned in the response.\n\n   ```sh\n   $ curl https://{API_ENDPOINT} /\n       -X POST \\\n       -H 'content-type: application/json' \\\n       -H 'x-api-key: {API_KEY}' \\\n       -d '{\n         \"url\": \"https://github.com/rayou/cdk-url-shortener\"\n       }'\n\n   {\"id\":\"LDkPh\"}\n   ```\n\n3. Visit `https://{API_ENDPOINT}/{ID}` then you'll be redirected to the destination URL.\n\n   ```sh\n   $ curl -v https://{API_ENDPOINT}/{ID} # e.g. https://mydomain.com/LDkPh\n\n   \u003c HTTP/2 301\n   \u003c content-type: text/html; charset=UTF-8\n   \u003c content-length: 309\n   \u003c location: https://github.com/rayou/cdk-url-shortener\n\n   \u003c!DOCTYPE html\u003e\u003chtml\u003e\u003chead\u003e\u003cmeta charset=\"UTF-8\" /\u003e\u003cmeta http-equiv=\"refresh\" content=\"0;url=https://github.com/rayou/cdk-url-shortener\" /\u003e\u003ctitle\u003eRedirecting to https://github.com/rayou/cdk-url-shortener\u003c/title\u003e\u003c/head\u003e\u003cbody\u003eRedirecting to \u003ca href=\"https://github.com/rayou/cdk-url-shortener\"\u003ehttps://github.com/rayou/cdk-url-shortener\u003c/a\u003e.\u003c/body\u003e\u003c/html\u003e\n   ```\n\n## Documentation\n\n### Construct API Reference\n\nSee [API.md](./API.md).\n\n### URL Shortener API Endpoints\n\n#### Shorten a Link\n\n**HTTP REQUEST**\n\n`POST /`\n\n**HEADERS**\n\n| Name           | Value                      | Required |\n| -------------- | -------------------------- | -------- |\n| `content-type` | `application/json`         | Required |\n| `x-api-key`    | Get your api key [here][1] | Required |\n\n[1]: https://console.aws.amazon.com/apigateway/home?#/api-keys\n\n**ARGUMENTS**\n\n| Parameter | Type   | Required | Description     |\n| --------- | ------ | -------- | --------------- |\n| `url`     | string | Required | Destination URL |\n\n**Example Request**\n\n```sh\ncurl https://mydomain.com /\n  -X POST \\\n  -H 'content-type: application/json' \\\n  -H 'x-api-key: v3rYsEcuRekey' \\\n  -d '{\n    \"url\": \"https://github.com/rayou/cdk-url-shortener\"\n  }'\n```\n\n**Response (201)**\n\n```json\n{\n  \"id\": \"LDkPh\"\n}\n```\n\n#### Visit a shortened URL\n\n**HTTP REQUEST**\n\n`GET /:id`\n\n**Example Request**\n\n```sh\ncurl https://mydomain.com/:id\n```\n\n**Response (301)**\n\n```sh\n\u003c HTTP/2 301\n\u003c content-type: text/html; charset=UTF-8\n\u003c content-length: 309\n\u003c location: https://github.com/rayou/cdk-url-shortener\n\n\u003c!DOCTYPE html\u003e\u003chtml\u003e\u003chead\u003e\u003cmeta charset=\"UTF-8\" /\u003e\u003cmeta http-equiv=\"refresh\" content=\"0;url=https://github.com/rayou/cdk-url-shortener\" /\u003e\u003ctitle\u003eRedirecting to https://github.com/rayou/cdk-url-shortener\u003c/title\u003e\u003c/head\u003e\u003cbody\u003eRedirecting to \u003ca href=\"https://github.com/rayou/cdk-url-shortener\"\u003ehttps://github.com/rayou/cdk-url-shortener\u003c/a\u003e.\u003c/body\u003e\u003c/html\u003e\n```\n\n## Supporting this project\n\nI'm working on this project in my free time, if you like my project, or found it helpful and would like to support me, you can buy me a coffee, any contributions are much appreciated! ❤️\n\n\u003ca href=\"https://www.buymeacoffee.com/rayou\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" style=\"height: 51px !important;width: 217px !important;\" \u003e\u003c/a\u003e\n\n## License\n\nThis project is distributed under the [Apache License, Version 2.0](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayou%2Fcdk-url-shortener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frayou%2Fcdk-url-shortener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayou%2Fcdk-url-shortener/lists"}