Skip to content

Commit 9e88a00

Browse files
authored
Merge pull request #1 from ngrok/shaquil/doc-95-import-content-from-current-docs-site
Add content from main in our prod docs
2 parents cfafa93 + 4274bad commit 9e88a00

File tree

3,199 files changed

+132380
-263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,199 files changed

+132380
-263
lines changed

app/root.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export const meta: V2_MetaFunction = ({ data, matches }) => {
4444

4545
return [
4646
getSeo({
47-
title: config.title,
48-
description: config.description,
47+
title: config?.title,
48+
description: config?.description,
4949
url: data.canonical ? data.canonical : "",
5050
}),
5151
];

app/routes/docs+/$.tsx

Lines changed: 89 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import type {
2-
LoaderArgs,
3-
V2_MetaFunction,
4-
HeadersFunction,
5-
SerializeFrom,
2+
LoaderArgs,
3+
V2_MetaFunction,
4+
HeadersFunction,
5+
SerializeFrom,
66
} from "@vercel/remix";
7-
import { json, redirect } from '@vercel/remix';
8-
import { useLoaderData } from '@remix-run/react'
9-
import { parseISO, format } from 'date-fns';
7+
import { json, redirect } from "@vercel/remix";
8+
import { useLoaderData } from "@remix-run/react";
9+
import { parseISO, format } from "date-fns";
1010

1111
import invariant from "tiny-invariant";
1212

@@ -17,78 +17,99 @@ import { getContent } from "~/utils/blog.server";
1717
import { CacheControl } from "~/utils/cache-control.server";
1818
import { getSeo } from "~/seo";
1919

20-
export const loader = async ({params}: LoaderArgs) => {
21-
let path = params["*"];
20+
export const loader = async ({ params }: LoaderArgs) => {
21+
let path = params["*"];
2222

23-
invariant(path, "BlogPost: path is required");
23+
invariant(path, "BlogPost: path is required");
2424

25-
if (!path) {
26-
throw new Error('path is not defined')
27-
}
25+
if (!path) {
26+
throw new Error("path is not defined");
27+
}
2828

29-
const files = await getContent(`docs/${path}`);
30-
let post = files && parseMarkdown(files[0].content);
29+
const files = await getContent(`docs/${path}`);
30+
let post = files && parseMarkdown(files[0].content);
3131

32-
//invariant(post, "Not found");
33-
if (!post) {
34-
throw json({}, {
35-
status: 404, headers: {}
36-
})
37-
}
32+
//invariant(post, "Not found");
33+
if (!post) {
34+
throw json(
35+
{},
36+
{
37+
status: 404,
38+
headers: {},
39+
}
40+
);
41+
}
3842

39-
return json({post}, {
40-
headers: {
41-
"Cache-Control": new CacheControl("swr").toString()
42-
}
43-
})
44-
}
43+
return json(
44+
{ post },
45+
{
46+
headers: {
47+
"Cache-Control": new CacheControl("swr").toString(),
48+
},
49+
}
50+
);
51+
};
4552

46-
export const headers: HeadersFunction = ({loaderHeaders}) => {
47-
return {
48-
'Cache-Control': loaderHeaders.get('Cache-Control')!
49-
}
50-
}
53+
export const headers: HeadersFunction = ({ loaderHeaders }) => {
54+
return {
55+
"Cache-Control": loaderHeaders.get("Cache-Control")!,
56+
};
57+
};
5158

5259
export const meta: V2_MetaFunction = ({ data, matches }) => {
53-
if(!data) return [];
60+
if (!data) return [];
5461

55-
const parentData = matches.flatMap((match) => match.data ?? [] );
62+
const parentData = matches.flatMap((match) => match.data ?? []);
5663

57-
return [
58-
getSeo({
59-
title: data.post.frontmatter.meta.title,
60-
description: data.post.frontmatter.meta.description,
61-
url: `${parentData[0].requestInfo.url}`,
62-
}),
63-
]
64-
}
64+
const {
65+
post: { frontmatter },
66+
} = data;
67+
console.error("Post info", data.post);
68+
69+
return [
70+
getSeo({
71+
title: frontmatter?.meta?.title ?? frontmatter?.title,
72+
description: frontmatter?.meta?.description ?? frontmatter?.description,
73+
url: `${parentData[0].requestInfo.url}`,
74+
}),
75+
];
76+
};
6577

6678
export default function BlogPost() {
67-
const {post} = useLoaderData<typeof loader>();
68-
69-
return (
70-
<div className="flex flex-col items-start justify-center w-full max-w-2xl mx-auto mb-16">
71-
<article className="flex flex-col items-start justify-center w-full max-w-2xl mx-auto mb-16">
72-
<h1 className="mb-4 text-3xl font-bold tracking-tight text-black md:text-5xl dark:text-white">{post.frontmatter.meta.title}</h1>
73-
<div className="flex flex-col items-start justify-between w-full mt-2 md:flex-row md:items-center">
74-
<div className="flex items-center space-x-2">
75-
{post.frontmatter.date && <p className="text-sm text-gray-700 dark:text-gray-300">
76-
{'Created: '}
77-
{post.frontmatter.date && format(parseISO(post.frontmatter.date), 'MMMM dd, yyyy')}
78-
</p>}
79-
{post.frontmatter.updated && <p className="text-sm text-gray-700 dark:text-gray-300">
80-
{'Last updated: '}
81-
{post.frontmatter.updated && format(parseISO(post.frontmatter.updated), 'MMMM dd, yyyy')}
82-
</p>}
83-
</div>
84-
<p className="mt-2 text-sm text-gray-600 dark:text-gray-400 min-w-32 md:mt-0">
85-
{post.readTime.text}
86-
</p>
87-
</div>
88-
<div className="w-full mt-4 prose dark:prose-dark max-w-none">
89-
{post.body && <MarkdownView content={post.body} />}
90-
</div>
91-
</article>
79+
const { post } = useLoaderData<typeof loader>();
80+
81+
const { frontmatter, body } = post;
82+
return (
83+
<div className="flex flex-col items-start justify-center w-full max-w-2xl mx-auto mb-16">
84+
<article className="flex flex-col items-start justify-center w-full max-w-2xl mx-auto mb-16">
85+
<h1 className="mb-4 text-3xl font-bold tracking-tight text-black md:text-5xl dark:text-white">
86+
{frontmatter?.meta?.title ?? frontmatter?.title}
87+
</h1>
88+
<div className="flex flex-col items-start justify-between w-full mt-2 md:flex-row md:items-center">
89+
<div className="flex items-center space-x-2">
90+
{frontmatter?.date && (
91+
<p className="text-sm text-gray-700 dark:text-gray-300">
92+
{"Created: "}
93+
{frontmatter?.date &&
94+
format(parseISO(frontmatter?.date), "MMMM dd, yyyy")}
95+
</p>
96+
)}
97+
{frontmatter?.updated && (
98+
<p className="text-sm text-gray-700 dark:text-gray-300">
99+
{"Last updated: "}
100+
{frontmatter?.updated &&
101+
format(parseISO(frontmatter?.updated), "MMMM dd, yyyy")}
102+
</p>
103+
)}
104+
</div>
105+
<p className="mt-2 text-sm text-gray-600 dark:text-gray-400 min-w-32 md:mt-0">
106+
{frontmatter?.readTime && frontmatter.readTime.text}
107+
</p>
108+
</div>
109+
<div className="w-full mt-4 prose dark:prose-dark max-w-none">
110+
{body && <MarkdownView content={body} />}
92111
</div>
93-
)
112+
</article>
113+
</div>
114+
);
94115
}

content/blog-cache.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"attributes":{"meta":{"title":"Hello World","description":"Isn't this awesome?"},"date":"2022-08-02T00:00:00","excerpt":"Hello","headers":{"Cache-Control":"no-cache"}},"body":"Hello...","url":"/blog/hello-world"},{"attributes":{"meta":{"title":"Another Post","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"Hello Gaseous cloud...","headers":{"Cache-Control":"no-cache"}},"body":"Hello Gaseous cloud......","url":"/blog/another-post"},{"attributes":{"meta":{"title":"ABC","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"Hello Gaseous cloud...","headers":{"Cache-Control":"no-cache"}},"body":"Hello Gaseous cloud......","url":"/blog/hello-world/abc"},{"attributes":{"meta":{"title":"A test","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"More Testin","headers":{"Cache-Control":"no-cache"}},"body":"More Testin...","url":"/blog/2022/test"},{"attributes":{"meta":{"title":"More Hello","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"Hello Gaseous cloud...","headers":{"Cache-Control":"no-cache"}},"body":"Hello Gaseous cloud......","url":"/blog/hello-world/more-hello"}]
1+
[{"attributes":{"meta":{"title":"Hello World","description":"Isn't this awesome?"},"date":"2022-08-02T00:00:00","excerpt":"Hello","headers":{"Cache-Control":"no-cache"}},"body":"...","url":"/blog/hello-world"},{"attributes":{"meta":{"title":"Another Post","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"Hello Gaseous cloud...","headers":{"Cache-Control":"no-cache"}},"body":"...","url":"/blog/another-post"},{"attributes":{"meta":{"title":"ABC","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"Hello Gaseous cloud...","headers":{"Cache-Control":"no-cache"}},"body":"...","url":"/blog/hello-world/abc"},{"attributes":{"meta":{"title":"A test","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"More Testin","headers":{"Cache-Control":"no-cache"}},"body":"...","url":"/blog/2022/test"},{"attributes":{"meta":{"title":"More Hello","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"Hello Gaseous cloud...","headers":{"Cache-Control":"no-cache"}},"body":"...","url":"/blog/hello-world/more-hello"}]

content/docs-cache.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

content/docs/agent-sdks/index.mdx

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
sidebar_position: 1
3+
title: Overview
4+
pagination_next: k8s/index
5+
---
6+
7+
import TabItem from "@theme/TabItem";
8+
import Tabs from "@theme/Tabs";
9+
10+
import RandomGoSdkExample from "/examples/go-sdk/http-random.mdx";
11+
import RandomJavascriptSdkExample from "/examples/javascript-sdk/http-random.mdx";
12+
import RandomPythonSdkExample from "/examples/python-sdk/http-random.mdx";
13+
import RandomRustSdkExample from "/examples/rust-sdk/http-random.mdx";
14+
15+
# Agent SDKs
16+
17+
## Overview
18+
19+
Agent SDKs enable you to embed ngrok directly into your application. They allow
20+
you to programmatically create ngrok endpoints. You handle connections from
21+
ngrok's edge just as if you opened a socket to listen on a port.
22+
23+
## Example Usage
24+
25+
<Tabs groupId="connectivity" queryString="cty">
26+
<TabItem value="go-sdk" label="Go SDK">
27+
<RandomGoSdkExample />
28+
</TabItem>
29+
<TabItem value="javascript-sdk" label="Javascript SDK">
30+
<RandomJavascriptSdkExample />
31+
</TabItem>
32+
<TabItem value="python-sdk" label="Python SDK">
33+
<RandomPythonSdkExample />
34+
</TabItem>
35+
<TabItem value="rust-sdk" label="Rust SDK">
36+
<RandomRustSdkExample />
37+
</TabItem>
38+
</Tabs>
39+
40+
## Supported Languages
41+
42+
| Language | Docs | Quickstart | Repository | Status |
43+
| ---------- | ------------------------------------------------------------------ | ----------------------------------------------- | ------------------------------------------------------------------------------ | ------ |
44+
| Go | [ngrok-go docs](https://pkg.go.dev/golang.ngrok.com/ngrok) | [ngrok-go quickstart](/getting-started/go/) | [github.com/ngrok/ngrok-go](https://github.com/ngrok/ngrok-go) | Stable |
45+
| Rust | [ngrok-rust docs](https://docs.rs/ngrok/latest/ngrok/) | [ngrok-rust quickstart](/getting-started/rust/) | [github.com/ngrok/ngrok-rust](https://github.com/ngrok/ngrok-rust) | Stable |
46+
| Python | [ngrok-python docs](https://ngrok.github.io/ngrok-python/) | | [github.com/ngrok/ngrok-python](https://github.com/ngrok/ngrok-python) | Stable |
47+
| JavaScript | [ngrok-javascript docs](https://ngrok.github.io/ngrok-javascript/) | | [github.com/ngrok/ngrok-javascript](https://github.com/ngrok/ngrok-javascript) | Stable |
48+
| Java | | | [github.com/ngrok/ngrok-java](https://github.com/ngrok/ngrok-java) | Alpha |
49+
50+
## When should I use Agent SDKs?
51+
52+
Agent SDKs are often a better fit for your use case over using the [ngrok
53+
agent](/agent/). This is especially true when running ngrok with
54+
production apps. Agent SDKs are a better choice if:
55+
56+
- You don't want to manage the lifetime of a separate agent process
57+
- You don't want to bundle and distribute the ngrok agent
58+
- The ngrok agent doesn't run on your target platform
59+
- The ngrok agent's resource requirements are too high for your target platform
60+
- You want fine-grained programmatic control over the agent's functionality
61+
62+
## Pricing
63+
64+
The agent SDKs are available to all ngrok users at no additional charge. You
65+
only incur costs if the resources provisioned by the SDKs incur a cost.

0 commit comments

Comments
 (0)