The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
add outline
Kiran K59ca73eee6d6
diff --git a/apps/docs/sdks/express.mdx b/apps/docs/sdks/express.mdxindex fe83c10a1f..d24312fe24 100644--- a/apps/docs/sdks/express.mdx+++ b/apps/docs/sdks/express.mdx@@ -2,3 +2,60 @@title: "Express"description: "Learn how to create a short link using the Express and Dub Node.js SDK."---++import Prerequisites from "/snippets/sdk-prerequisites.mdx";+import Install from "/snippets/sdk-install-nodejs.mdx";++## 1. Prerequisites++<Prerequisites />++## 2. Install++<Install />++## 3. Create link++Let's create a short link using the Dub Node.js SDK.++```typescript create-link.ts++```++## 4. Upsert link++Dub Node.js SDK provides a method to create or update a link so you don't have to worry about checking if the link already exists.++```typescript upsert-link.ts++```++## 5. Update link++Let's update an existing link using the Dub Node.js SDK.++```typescript update-link.ts++```++Both `upsert` and `update` methods accept the same parameters.++## 6. Retrieve analytics for link++Dub allows you to retrieve analytics for a link using the Dub Node.js SDK.++```typescript get-analytics.ts++```++## 7. Examples++<CardGroup cols={2}>+ <Card+ title="Node.js Example"+ icon="arrow-up-right-from-square"+ href="https://github.com/dubinc/examples"+ >+ See the full example on GitHub.+ </Card>+</CardGroup>diff --git a/apps/docs/sdks/nextjs.mdx b/apps/docs/sdks/nextjs.mdxindex c19b0b8bc6..6248957171 100644--- a/apps/docs/sdks/nextjs.mdx+++ b/apps/docs/sdks/nextjs.mdx@@ -2,3 +2,60 @@title: "Next.js"description: "Learn how to create a short link using the Next.js and Dub Node.js SDK."---++import Prerequisites from "/snippets/sdk-prerequisites.mdx";+import Install from "/snippets/sdk-install-nodejs.mdx";++## 1. Prerequisites++<Prerequisites />++## 2. Install++<Install />++## 3. Create link++Let's create a short link using the Dub Node.js SDK.++```typescript create-link.ts++```++## 4. Upsert link++Dub Node.js SDK provides a method to create or update a link so you don't have to worry about checking if the link already exists.++```typescript upsert-link.ts++```++## 5. Update link++Let's update an existing link using the Dub Node.js SDK.++```typescript update-link.ts++```++Both `upsert` and `update` methods accept the same parameters.++## 6. Retrieve analytics for link++Dub allows you to retrieve analytics for a link using the Dub Node.js SDK.++```typescript get-analytics.ts++```++## 7. Examples++<CardGroup cols={2}>+ <Card+ title="Node.js Example"+ icon="arrow-up-right-from-square"+ href="https://github.com/dubinc/examples"+ >+ See the full example on GitHub.+ </Card>+</CardGroup>diff --git a/apps/docs/sdks/nodejs.mdx b/apps/docs/sdks/nodejs.mdxindex 29b8fed256..50a0f7f8f9 100644--- a/apps/docs/sdks/nodejs.mdx+++ b/apps/docs/sdks/nodejs.mdx@@ -3,42 +3,16 @@ title: "Introduction"description: "Learn how to create a short link using the Dub Node.js SDK."----## 1. Prerequisites+import Prerequisites from "/snippets/sdk-prerequisites.mdx";+import Install from "/snippets/sdk-install-nodejs.mdx";-To follow this guide, you will need to:+## 1. Prerequisites-- [Create a Dub account](https://app.dub.co/login)-- [Create an API key](https://app.dub.co/settings/tokens)+<Prerequisites />## 2. Install-Install the Dub Node.js SDK using your preferred package manager:--<Tabs>- <Tab title="npm">-- ```bash- npm install dub- ```-- </Tab>-- <Tab title="pnpm">-- ```bash- pnpm add dub- ```-- </Tab>-- <Tab title="yarn">-- ```bash- yarn add dub- ```-- </Tab>-</Tabs>+<Install />## 3. Create link@@ -121,7 +95,11 @@ const timeseries = response as ClicksTimeseries[];## 7. Examples<CardGroup cols={2}>- <Card title="Node.js Example" icon="arrow-up-right-from-square" href="https://github.com/dubinc/examples">+ <Card+ title="Node.js Example"+ icon="arrow-up-right-from-square"+ href="https://github.com/dubinc/examples"+ >See the full example on GitHub.</Card>-</CardGroup>\ No newline at end of file+</CardGroup>diff --git a/apps/docs/sdks/nuxt.mdx b/apps/docs/sdks/nuxt.mdxindex 3c66ab1deb..eb4fb52ea7 100644--- a/apps/docs/sdks/nuxt.mdx+++ b/apps/docs/sdks/nuxt.mdx@@ -2,3 +2,60 @@title: "Nuxt"description: "Learn how to create a short link using the Nuxt and Dub Node.js SDK."---++import Prerequisites from "/snippets/sdk-prerequisites.mdx";+import Install from "/snippets/sdk-install-nodejs.mdx";++## 1. Prerequisites++<Prerequisites />++## 2. Install++<Install />++## 3. Create link++Let's create a short link using the Dub Node.js SDK.++```typescript create-link.ts++```++## 4. Upsert link++Dub Node.js SDK provides a method to create or update a link so you don't have to worry about checking if the link already exists.++```typescript upsert-link.ts++```++## 5. Update link++Let's update an existing link using the Dub Node.js SDK.++```typescript update-link.ts++```++Both `upsert` and `update` methods accept the same parameters.++## 6. Retrieve analytics for link++Dub allows you to retrieve analytics for a link using the Dub Node.js SDK.++```typescript get-analytics.ts++```++## 7. Examples++<CardGroup cols={2}>+ <Card+ title="Node.js Example"+ icon="arrow-up-right-from-square"+ href="https://github.com/dubinc/examples"+ >+ See the full example on GitHub.+ </Card>+</CardGroup>diff --git a/apps/docs/sdks/remix.mdx b/apps/docs/sdks/remix.mdxindex 32e88413e7..8497722e9d 100644--- a/apps/docs/sdks/remix.mdx+++ b/apps/docs/sdks/remix.mdx@@ -2,3 +2,60 @@title: "Remix"description: "Learn how to create a short link using the Remix and Dub Node.js SDK."---++import Prerequisites from "/snippets/sdk-prerequisites.mdx";+import Install from "/snippets/sdk-install-nodejs.mdx";++## 1. Prerequisites++<Prerequisites />++## 2. Install++<Install />++## 3. Create link++Let's create a short link using the Dub Node.js SDK.++```typescript create-link.ts++```++## 4. Upsert link++Dub Node.js SDK provides a method to create or update a link so you don't have to worry about checking if the link already exists.++```typescript upsert-link.ts++```++## 5. Update link++Let's update an existing link using the Dub Node.js SDK.++```typescript update-link.ts++```++Both `upsert` and `update` methods accept the same parameters.++## 6. Retrieve analytics for link++Dub allows you to retrieve analytics for a link using the Dub Node.js SDK.++```typescript get-analytics.ts++```++## 7. Examples++<CardGroup cols={2}>+ <Card+ title="Node.js Example"+ icon="arrow-up-right-from-square"+ href="https://github.com/dubinc/examples"+ >+ See the full example on GitHub.+ </Card>+</CardGroup>diff --git a/apps/docs/snippets/sdk-install-nodejs.mdx b/apps/docs/snippets/sdk-install-nodejs.mdxnew file mode 100644index 0000000000..dad2c61e03--- /dev/null+++ b/apps/docs/snippets/sdk-install-nodejs.mdx@@ -0,0 +1,27 @@+Install the Dub Node.js SDK using your preferred package manager:++<Tabs>+ <Tab title="npm">++ ```bash+ npm install dub+ ```++ </Tab>++ <Tab title="pnpm">++ ```bash+ pnpm add dub+ ```++ </Tab>++ <Tab title="yarn">++ ```bash+ yarn add dub+ ```++ </Tab>+</Tabs>diff --git a/apps/docs/snippets/sdk-prerequisites.mdx b/apps/docs/snippets/sdk-prerequisites.mdxnew file mode 100644index 0000000000..eebf9e361a--- /dev/null+++ b/apps/docs/snippets/sdk-prerequisites.mdx@@ -0,0 +1,4 @@+To follow this guide, you will need to:++- [Create a Dub account](https://app.dub.co/login)+- [Create an API key](https://app.dub.co/settings/tokens)