Skip to content

Commit 304a240

Browse files
Sachin Sridharsachin9996
Sachin Sridhar
authored andcommitted
use subtrace token instead of subt.link in docs
1 parent 1427444 commit 304a240

File tree

3 files changed

+25
-89
lines changed

3 files changed

+25
-89
lines changed

docker.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: "Track requests in your Dockerized app with Subtrace."
55
icon: "docker"
66
---
77

8-
If your app runs in a docker container, you can use Subtrace to monitor all its
8+
If your app runs in a Docker container, you can use Subtrace to monitor all its
99
requests. Here's how you can get started:
1010

1111
<Steps>

nextjs.mdx

+11-42
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,8 @@ description: "Connect your Next.js backend to Chrome DevTools using Subtrace"
55
icon: "node-js"
66
---
77

8-
You can connect your Next.js backend to Chrome DevTools with just one command.
9-
With Subtrace, you can inspect the status, headers, payload, and latency of
10-
all API requests.
11-
12-
For this guide, we'll use a minimal Next.js app as an example. The app has one page (`index.js`) and one API handler (`app/api/foo/route.js`):
13-
14-
```jsx
15-
// index.jsx
16-
"use client";
17-
18-
export default function App() {
19-
return (
20-
<div>
21-
<h1>Next.js + Subtrace</h1>
22-
<button onClick={handleClick}>Make a call to the server</button>
23-
</div>
24-
);
25-
26-
async function handleClick() {
27-
const response = await fetch("/api/foo");
28-
const data = await response.json();
29-
alert(data.message);
30-
}
31-
}
32-
```
33-
34-
```js
35-
// app/api/foo/route.js
36-
export async function GET(req) {
37-
return new Response(JSON.stringify({ message: "Hello from the server!" }), {
38-
headers: { "Content-Type": "application/json" },
39-
});
40-
}
41-
```
8+
For this guide, we'll use a minimal Next.js app as an example, but any Next.js app should work fine.
9+
You can find the complete source code used in this demo [here](https://github.com/subtrace/nextjs-demo).
4210

4311
To get started, download the latest version of Subtrace using the following command:
4412

@@ -47,18 +15,19 @@ curl -fsSLO "https://subtrace.dev/download/latest/$(uname -s)/$(uname -m)/subtra
4715
chmod +x ./subtrace
4816
```
4917

18+
Then get a `SUBTRACE_TOKEN` from the Subtrace [dashboard](https://subtrace.dev/dashboard)
19+
for free and set it as an environment variable.
20+
21+
```bash
22+
# get a tracer token for free at https://subtrace.dev/dashboard
23+
export SUBTRACE_TOKEN=
24+
```
25+
5026
Build and start your server using Subtrace:
5127

5228
```bash
5329
npm install
5430
./subtrace run -- npm run dev
5531
```
5632

57-
Open the `subt.link` URL in your browser to get to the Subtrace dashboard. Go to `localhost:3000`
58-
and make some requests to the server to see them show up in realtime on the Subtrace dashboard!
59-
60-
<Expandable title="example output">
61-
<img className="rounded-xl" src="/images/nextjs-link.png" />
62-
</Expandable>
63-
64-
You can find the complete source code used in this demo [here](https://github.com/subtrace/nextjs-demo).
33+
That's it! You can now visit [localhost:3000](localhost:3000) to see them automatically appear in the Subtrace [dashboard](https://subtrace.dev/dashboard) in realtime.

sveltekit.mdx

+13-46
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,8 @@ description: "Connect your SvelteKit app to Chrome DevTools using Subtrace"
55
icon: "node-js"
66
---
77

8-
You can connect your SvelteKit app to Chrome DevTools with just one command
9-
to see the status, headers, payload, and latency of all API requests.
10-
11-
For this guide, we'll use a simple SvelteKit app as an example. The app has one page (`+page.svelte`) and one API handler (`routes/api/hello/+server.ts`).
12-
13-
```html
14-
<!-- +page.svelte -->
15-
<script>
16-
let message = "";
17-
18-
async function getMessage() {
19-
const res = await fetch("/api/hello");
20-
const data = await res.json();
21-
message = data.message;
22-
}
23-
</script>
24-
25-
<main>
26-
<h1>Trigger a GET request with the button.</h1>
27-
<button on:click="{getMessage}">Make API call</button>
28-
<h2>{message}</h2>
29-
</main>
30-
```
31-
32-
```ts
33-
// routes/api/hello/+server.ts
34-
let count = 0;
35-
36-
export function GET(): Response {
37-
count++;
38-
return new Response(
39-
JSON.stringify({
40-
message: `Called ${count} ${count === 1 ? "time" : "times"}.`,
41-
}),
42-
{ headers: { "Content-Type": "application/json" } }
43-
);
44-
}
45-
```
8+
For this guide, we'll use a simple SvelteKit app as an example, but any SvelteKit app should work fine.
9+
You can find the complete source code for this example [here](https://github.com/subtrace/sveltekit-demo).
4610

4711
To get started, download the latest version of Subtrace using the following command:
4812

@@ -51,6 +15,14 @@ curl -fsSLO "https://subtrace.dev/download/latest/$(uname -s)/$(uname -m)/subtra
5115
chmod +x ./subtrace
5216
```
5317

18+
Then get a `SUBTRACE_TOKEN` from the Subtrace [dashboard](https://subtrace.dev/dashboard)
19+
for free and set it as an environment variable.
20+
21+
```bash
22+
# get a tracer token for free at https://subtrace.dev/dashboard
23+
export SUBTRACE_TOKEN=
24+
```
25+
5426
Build and start your server using Subtrace:
5527

5628
```bash
@@ -59,11 +31,6 @@ npm run build
5931
./subtrace run -- npm run dev
6032
```
6133

62-
Open the `subt.link` URL in your browser to get to the Subtrace dashboard. Go to `localhost:5173`
63-
and make some requests to the server to see them show up in realtime on the Subtrace dashboard!
64-
65-
<Expandable title="example output">
66-
<img className="rounded-xl" src="/images/sveltekit-link.png" />
67-
</Expandable>
68-
69-
You can find the complete source code for this example [here](https://github.com/subtrace/sveltekit-demo).
34+
That's it! You can now visit [localhost:5173](localhost:5173) and make requests
35+
to the app that show up on the Subtrace [dashboard](https://subtrace.dev/dashboard)
36+
in realtime.

0 commit comments

Comments
 (0)