create-qwik 0.0.38 → 0.0.39-dev20220805031634
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/starters/apps/base/package.json +7 -7
- package/starters/apps/base/src/entry.dev.tsx +4 -2
- package/starters/apps/base/src/entry.ssr.tsx +3 -3
- package/starters/apps/blank/src/entry.express.tsx +10 -3
- package/starters/apps/blank/src/entry.ssr.tsx +3 -3
- package/starters/apps/qwik-city/package.json +1 -1
- package/starters/apps/qwik-city/src/components/body/body.tsx +2 -2
- package/starters/apps/qwik-city/src/components/breadcrumbs/breadcrumbs.css +25 -0
- package/starters/apps/qwik-city/src/components/breadcrumbs/breadcrumbs.tsx +77 -0
- package/starters/apps/qwik-city/src/components/counter/counter.tsx +2 -2
- package/starters/apps/qwik-city/src/components/footer/footer.css +1 -1
- package/starters/apps/qwik-city/src/components/footer/footer.tsx +3 -1
- package/starters/apps/qwik-city/src/components/header/header.css +10 -1
- package/starters/apps/qwik-city/src/components/header/header.tsx +24 -32
- package/starters/apps/qwik-city/src/components/menu/menu.css +10 -0
- package/starters/apps/qwik-city/src/components/menu/menu.tsx +5 -5
- package/starters/apps/qwik-city/src/global.css +21 -12
- package/starters/apps/qwik-city/src/root.tsx +1 -1
- package/starters/apps/qwik-city/src/routes/about-us.tsx +2 -4
- package/starters/apps/qwik-city/src/routes/api/[org]/[user].json/index.ts +12 -23
- package/starters/apps/qwik-city/src/routes/api/_layout-foo/index.tsx +18 -24
- package/starters/apps/qwik-city/src/routes/api/data.json.ts +6 -9
- package/starters/apps/qwik-city/src/routes/api/index@foo.tsx +7 -4
- package/starters/apps/qwik-city/src/routes/blog/[...slug].tsx +28 -5
- package/starters/apps/qwik-city/src/routes/blog/_layout/index.tsx +2 -2
- package/starters/apps/qwik-city/src/routes/dashboard/index.tsx +8 -0
- package/starters/apps/qwik-city/src/routes/docs/[category]/[id]/index.tsx +14 -6
- package/starters/apps/qwik-city/src/routes/docs/{_layout/docs.css → _layout!/index.css} +2 -1
- package/starters/apps/qwik-city/src/routes/docs/_layout!/index.tsx +31 -0
- package/starters/apps/qwik-city/src/routes/docs/_menu.md +4 -2
- package/starters/apps/qwik-city/src/routes/docs/getting-started.md +44 -0
- package/starters/apps/qwik-city/src/routes/docs/index.tsx +2 -4
- package/starters/apps/qwik-city/src/routes/docs/{introduction → overview}/index.md +2 -2
- package/starters/apps/qwik-city/src/routes/index.tsx +6 -1
- package/starters/apps/qwik-city/src/routes/products/[id].tsx +122 -0
- package/starters/features/react/package.json +1 -1
- package/starters/features/react/src/entry.ssr.tsx +1 -1
- package/starters/features/tailwindcss/{postcss.config.js → postcss.config.cjs} +0 -0
- package/starters/features/tailwindcss/{tailwind.config.js → tailwind.config.cjs} +0 -0
- package/starters/servers/cloudflare-pages/src/entry.cloudflare.tsx +4 -50
- package/starters/servers/express/package.json +1 -1
- package/starters/servers/express/src/entry.express.tsx +19 -8
- package/starters/servers/{netlify → netlify-edge}/.node-version +0 -0
- package/starters/servers/{netlify → netlify-edge}/README.md +0 -0
- package/starters/servers/{netlify → netlify-edge}/netlify.toml +0 -0
- package/starters/servers/{netlify → netlify-edge}/package.json +0 -0
- package/starters/servers/{netlify → netlify-edge}/public/_headers +0 -0
- package/starters/servers/netlify-edge/src/entry.netlify.ts +6 -0
- package/starters/servers/{netlify → netlify-edge}/tsconfig.json +0 -0
- package/starters/apps/qwik-city/src/routes/__auth/_layout.tsx +0 -17
- package/starters/apps/qwik-city/src/routes/__auth/sign-in.tsx +0 -25
- package/starters/apps/qwik-city/src/routes/__auth/sign-up.tsx +0 -29
- package/starters/apps/qwik-city/src/routes/docs/_layout/index.tsx +0 -23
- package/starters/apps/qwik-city/src/routes/docs/getting-started.mdx +0 -32
- package/starters/servers/netlify/src/entry.netlify.ts +0 -27
package/package.json
CHANGED
|
@@ -15,21 +15,21 @@
|
|
|
15
15
|
"typecheck": "tsc --incremental --noEmit"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@builder.io/qwik": "0.0.
|
|
18
|
+
"@builder.io/qwik": "0.0.39-dev20220805031634",
|
|
19
19
|
"@types/eslint": "8.4.5",
|
|
20
20
|
"@types/node": "latest",
|
|
21
|
-
"@typescript-eslint/eslint-plugin": "5.30.
|
|
22
|
-
"@typescript-eslint/parser": "5.30.
|
|
23
|
-
"eslint-plugin-qwik": "0.0.
|
|
21
|
+
"@typescript-eslint/eslint-plugin": "5.30.7",
|
|
22
|
+
"@typescript-eslint/parser": "5.30.7",
|
|
23
|
+
"eslint-plugin-qwik": "0.0.39-dev20220805031634",
|
|
24
24
|
"eslint": "8.20.0",
|
|
25
|
-
"node-fetch": "3.2.
|
|
25
|
+
"node-fetch": "3.2.9",
|
|
26
26
|
"typescript": "4.7.4",
|
|
27
|
-
"vite": "3.0.
|
|
27
|
+
"vite": "3.0.2"
|
|
28
28
|
},
|
|
29
29
|
"type": "module",
|
|
30
30
|
"homepage": "https://qwik.builder.io/",
|
|
31
31
|
"private": true,
|
|
32
32
|
"engines": {
|
|
33
|
-
"node": ">=
|
|
33
|
+
"node": "^14.18.0 || >=16.0.0"
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { render } from '@builder.io/qwik';
|
|
1
|
+
import { render, RenderOptions } from '@builder.io/qwik';
|
|
2
2
|
import Root from './root';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -10,4 +10,6 @@ import Root from './root';
|
|
|
10
10
|
* - More code is transferred to the browser than in SSR mode.
|
|
11
11
|
* - Optimizer/Serialization/Deserialization code is not exercised!
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
export default function (opts: RenderOptions) {
|
|
14
|
+
return render(document, <Root />, opts);
|
|
15
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { renderToStream, RenderToStreamOptions } from '@builder.io/qwik/server';
|
|
2
2
|
import { manifest } from '@qwik-client-manifest';
|
|
3
3
|
import Root from './root';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Server-Side Render method to be called by a server.
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
8
|
+
export default function (opts: RenderToStreamOptions) {
|
|
9
9
|
// Render the Root component to a string
|
|
10
10
|
// Pass in the manifest that was generated from the client build
|
|
11
|
-
return
|
|
11
|
+
return renderToStream(<Root />, {
|
|
12
12
|
manifest,
|
|
13
13
|
...opts,
|
|
14
14
|
});
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { join } from 'path';
|
|
3
|
-
import {
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import render from './entry.ssr';
|
|
5
|
+
|
|
6
|
+
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* Create an express server
|
|
@@ -32,11 +35,15 @@ app.get('/*', async (req, res, next) => {
|
|
|
32
35
|
try {
|
|
33
36
|
// Render the Root component to a string
|
|
34
37
|
const result = await render({
|
|
35
|
-
|
|
38
|
+
stream: res,
|
|
36
39
|
});
|
|
37
40
|
|
|
38
41
|
// respond with SSR'd HTML
|
|
39
|
-
|
|
42
|
+
if ('html' in result) {
|
|
43
|
+
res.send((result as any).html);
|
|
44
|
+
} else {
|
|
45
|
+
res.end();
|
|
46
|
+
}
|
|
40
47
|
} catch (e) {
|
|
41
48
|
// Error while server-side rendering
|
|
42
49
|
next(e);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { renderToStream, RenderToStreamOptions } from '@builder.io/qwik/server';
|
|
2
2
|
import { manifest } from '@qwik-client-manifest';
|
|
3
3
|
import Root from './root';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Server-Side Render method to be called by a server.
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
8
|
+
export default function (opts: RenderToStreamOptions) {
|
|
9
9
|
// Render the Root component to a string
|
|
10
10
|
// Pass in the manifest that was generated from the client build
|
|
11
|
-
return
|
|
11
|
+
return renderToStream(<Root />, {
|
|
12
12
|
manifest,
|
|
13
13
|
...opts,
|
|
14
14
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { component$, Host } from '@builder.io/qwik';
|
|
2
|
-
import {
|
|
2
|
+
import { RouterOutlet } from '@builder.io/qwik-city';
|
|
3
3
|
|
|
4
4
|
export const Body = component$(
|
|
5
5
|
() => {
|
|
6
6
|
return (
|
|
7
7
|
<Host>
|
|
8
|
-
<
|
|
8
|
+
<RouterOutlet />
|
|
9
9
|
</Host>
|
|
10
10
|
);
|
|
11
11
|
},
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
nav.breadcrumbs {
|
|
2
|
+
padding: 5px;
|
|
3
|
+
border-bottom: 1px solid #ddd;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
nav.breadcrumbs > span {
|
|
7
|
+
display: inline-block;
|
|
8
|
+
padding: 5px 0;
|
|
9
|
+
font-size: 12px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
nav.breadcrumbs > span a {
|
|
13
|
+
text-decoration: none;
|
|
14
|
+
color: inherit;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
nav.breadcrumbs > span::after {
|
|
18
|
+
content: '>';
|
|
19
|
+
padding: 0 5px;
|
|
20
|
+
opacity: 0.4;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
nav.breadcrumbs > span:last-child::after {
|
|
24
|
+
display: none;
|
|
25
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { component$, Host, useStyles$ } from '@builder.io/qwik';
|
|
2
|
+
import { useContent, useLocation, ContentMenu } from '@builder.io/qwik-city';
|
|
3
|
+
import styles from './breadcrumbs.css?inline';
|
|
4
|
+
|
|
5
|
+
export const Breadcrumbs = component$(
|
|
6
|
+
() => {
|
|
7
|
+
useStyles$(styles);
|
|
8
|
+
|
|
9
|
+
const { menu } = useContent();
|
|
10
|
+
const loc = useLocation();
|
|
11
|
+
|
|
12
|
+
const breadcrumbs = createBreadcrumbs(menu, loc.pathname);
|
|
13
|
+
if (breadcrumbs.length === 0) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Host class="breadcrumbs">
|
|
19
|
+
{breadcrumbs.map((b) => (
|
|
20
|
+
<span>{b.href ? <a href={b.href}>{b.text}</a> : b.text}</span>
|
|
21
|
+
))}
|
|
22
|
+
</Host>
|
|
23
|
+
);
|
|
24
|
+
},
|
|
25
|
+
{ tagName: 'nav' }
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export function createBreadcrumbs(menu: ContentMenu | undefined, pathname: string) {
|
|
29
|
+
if (menu?.items) {
|
|
30
|
+
for (const indexA of menu.items) {
|
|
31
|
+
const breadcrumbA: ContentBreadcrumb = {
|
|
32
|
+
text: indexA.text,
|
|
33
|
+
};
|
|
34
|
+
if (typeof indexA.href === 'string') {
|
|
35
|
+
breadcrumbA.href = indexA.href;
|
|
36
|
+
}
|
|
37
|
+
if (indexA.href === pathname) {
|
|
38
|
+
return [breadcrumbA];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (indexA.items) {
|
|
42
|
+
for (const indexB of indexA.items) {
|
|
43
|
+
const breadcrumbB: ContentBreadcrumb = {
|
|
44
|
+
text: indexB.text,
|
|
45
|
+
};
|
|
46
|
+
if (typeof indexB.href === 'string') {
|
|
47
|
+
breadcrumbB.href = indexB.href;
|
|
48
|
+
}
|
|
49
|
+
if (indexB.href === pathname) {
|
|
50
|
+
return [breadcrumbA, breadcrumbB];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (indexB.items) {
|
|
54
|
+
for (const indexC of indexB.items) {
|
|
55
|
+
const breadcrumbC: ContentBreadcrumb = {
|
|
56
|
+
text: indexC.text,
|
|
57
|
+
};
|
|
58
|
+
if (typeof indexC.href === 'string') {
|
|
59
|
+
breadcrumbC.href = indexC.href;
|
|
60
|
+
}
|
|
61
|
+
if (indexC.href === pathname) {
|
|
62
|
+
return [breadcrumbA, breadcrumbB, breadcrumbC];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface ContentBreadcrumb {
|
|
75
|
+
text: string;
|
|
76
|
+
href?: string;
|
|
77
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { component$,
|
|
1
|
+
import { component$, useStyles$, useStore } from '@builder.io/qwik';
|
|
2
2
|
|
|
3
3
|
export const Counter = component$(() => {
|
|
4
4
|
const store = useStore({ count: 0 });
|
|
5
|
-
|
|
5
|
+
useStyles$(`
|
|
6
6
|
.counter {
|
|
7
7
|
border: 3px solid #1474ff;
|
|
8
8
|
padding: 10px;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
header {
|
|
2
|
+
background-color: #0093ee;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
header .header-inner {
|
|
2
6
|
display: grid;
|
|
3
7
|
grid-template-columns: 1fr auto auto;
|
|
4
8
|
padding: 10px;
|
|
5
|
-
|
|
9
|
+
max-width: 800px;
|
|
10
|
+
margin: 0 auto;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.full-screen header .header-inner {
|
|
14
|
+
max-width: 100%;
|
|
6
15
|
}
|
|
7
16
|
|
|
8
17
|
header a {
|
|
@@ -3,43 +3,35 @@ import { useLocation } from '@builder.io/qwik-city';
|
|
|
3
3
|
import styles from './header.css?inline';
|
|
4
4
|
|
|
5
5
|
export default component$(
|
|
6
|
-
(
|
|
6
|
+
() => {
|
|
7
7
|
useStyles$(styles);
|
|
8
8
|
|
|
9
9
|
const pathname = useLocation().pathname;
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
|
-
<Host
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
onClick$={() => {
|
|
36
|
-
if (themeCtx.theme === 'light') {
|
|
37
|
-
themeCtx.theme = 'dark';
|
|
38
|
-
} else {
|
|
39
|
-
themeCtx.theme = 'light';
|
|
40
|
-
}
|
|
41
|
-
}}
|
|
42
|
-
/> */}
|
|
12
|
+
<Host>
|
|
13
|
+
<div class="header-inner">
|
|
14
|
+
<section class="logo">
|
|
15
|
+
<a href="/">Qwik City 🏙</a>
|
|
16
|
+
</section>
|
|
17
|
+
<nav>
|
|
18
|
+
<a href="/blog" class={{ active: pathname.startsWith('/blog') }}>
|
|
19
|
+
Blog
|
|
20
|
+
</a>
|
|
21
|
+
<a href="/docs" class={{ active: pathname.startsWith('/docs') }}>
|
|
22
|
+
Docs
|
|
23
|
+
</a>
|
|
24
|
+
<a href="/api" class={{ active: pathname.startsWith('/api') }}>
|
|
25
|
+
API
|
|
26
|
+
</a>
|
|
27
|
+
<a href="/products/hat" class={{ active: pathname.startsWith('/products') }}>
|
|
28
|
+
Products
|
|
29
|
+
</a>
|
|
30
|
+
<a href="/about-us" class={{ active: pathname.startsWith('/about-us') }}>
|
|
31
|
+
About Us
|
|
32
|
+
</a>
|
|
33
|
+
</nav>
|
|
34
|
+
</div>
|
|
43
35
|
</Host>
|
|
44
36
|
);
|
|
45
37
|
},
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { component$, Host,
|
|
2
|
-
import { useContent, useLocation } from '@builder.io/qwik-city';
|
|
1
|
+
import { component$, Host, useStyles$ } from '@builder.io/qwik';
|
|
2
|
+
import { useContent, Link, useLocation } from '@builder.io/qwik-city';
|
|
3
3
|
import styles from './menu.css?inline';
|
|
4
4
|
|
|
5
5
|
export const Menu = component$(
|
|
6
6
|
() => {
|
|
7
|
-
|
|
7
|
+
useStyles$(styles);
|
|
8
8
|
|
|
9
9
|
const { menu } = useContent();
|
|
10
10
|
const loc = useLocation();
|
|
@@ -18,14 +18,14 @@ export const Menu = component$(
|
|
|
18
18
|
<ul>
|
|
19
19
|
{item.items?.map((item) => (
|
|
20
20
|
<li>
|
|
21
|
-
<
|
|
21
|
+
<Link
|
|
22
22
|
href={item.href}
|
|
23
23
|
class={{
|
|
24
24
|
'is-active': loc.pathname === item.href,
|
|
25
25
|
}}
|
|
26
26
|
>
|
|
27
27
|
{item.text}
|
|
28
|
-
</
|
|
28
|
+
</Link>
|
|
29
29
|
</li>
|
|
30
30
|
))}
|
|
31
31
|
</ul>
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
html {
|
|
2
|
-
line-height: 1.5;
|
|
3
|
-
-webkit-text-size-adjust: 100%;
|
|
4
|
-
-moz-tab-size: 4;
|
|
5
|
-
-o-tab-size: 4;
|
|
6
|
-
tab-size: 4;
|
|
7
|
-
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
8
|
-
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
|
9
|
-
'Segoe UI Symbol', 'Noto Color Emoji';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
1
|
body {
|
|
2
|
+
margin: 0;
|
|
13
3
|
padding: 0;
|
|
14
|
-
|
|
4
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
5
|
+
sans-serif;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
main {
|
|
9
|
+
padding: 10px 20px;
|
|
10
|
+
max-width: 800px;
|
|
11
|
+
margin: 0 auto;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.full-screen main {
|
|
15
|
+
max-width: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
a {
|
|
19
|
+
color: #006eb3;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
a:hover {
|
|
23
|
+
text-decoration: none;
|
|
15
24
|
}
|
|
@@ -3,30 +3,19 @@ import os from 'os';
|
|
|
3
3
|
|
|
4
4
|
export const onGet: EndpointHandler = ({ request, params }) => {
|
|
5
5
|
return {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
arch: os.arch(),
|
|
14
|
-
node: process.versions.node,
|
|
15
|
-
},
|
|
6
|
+
timestamp: Date.now(),
|
|
7
|
+
method: request.method,
|
|
8
|
+
url: request.url,
|
|
9
|
+
params,
|
|
10
|
+
os: os.platform(),
|
|
11
|
+
arch: os.arch(),
|
|
12
|
+
node: process.versions.node,
|
|
16
13
|
};
|
|
17
14
|
};
|
|
18
15
|
|
|
19
|
-
export const onPost: EndpointHandler = async ({ request,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
method: request.method,
|
|
25
|
-
url: request.url,
|
|
26
|
-
params,
|
|
27
|
-
os: os.platform(),
|
|
28
|
-
arch: os.arch(),
|
|
29
|
-
node: process.versions.node,
|
|
30
|
-
},
|
|
31
|
-
};
|
|
16
|
+
export const onPost: EndpointHandler = async ({ request, response }) => {
|
|
17
|
+
response.headers.set('Content-Type', 'text/plain');
|
|
18
|
+
return `Platform: ${os.platform()}, Node: ${process.versions.node}, HTTP Method: ${
|
|
19
|
+
request.method
|
|
20
|
+
}`;
|
|
32
21
|
};
|
|
@@ -1,38 +1,32 @@
|
|
|
1
|
-
import { component$, Host, Slot,
|
|
1
|
+
import { component$, Host, Slot, useStyles$ } from '@builder.io/qwik';
|
|
2
2
|
import type { DocumentHead } from '@builder.io/qwik-city';
|
|
3
|
-
import Footer from '../../../components/footer/footer';
|
|
4
|
-
import Header from '../../../components/header/header';
|
|
5
3
|
import styles from './api.css?inline';
|
|
6
4
|
|
|
7
5
|
export default component$(() => {
|
|
8
|
-
|
|
6
|
+
useStyles$(styles);
|
|
9
7
|
|
|
10
8
|
return (
|
|
11
|
-
<Host>
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<Slot />
|
|
27
|
-
</section>
|
|
28
|
-
</main>
|
|
29
|
-
<Footer />
|
|
9
|
+
<Host class="api">
|
|
10
|
+
<aside class="api-menu">
|
|
11
|
+
<h2>API</h2>
|
|
12
|
+
<ul>
|
|
13
|
+
<li>
|
|
14
|
+
<a href="/api/builder.io/oss.json">Org/User</a>
|
|
15
|
+
</li>
|
|
16
|
+
<li>
|
|
17
|
+
<a href="/api/data.json">Data</a>
|
|
18
|
+
</li>
|
|
19
|
+
</ul>
|
|
20
|
+
</aside>
|
|
21
|
+
<section class="api-content">
|
|
22
|
+
<Slot />
|
|
23
|
+
</section>
|
|
30
24
|
</Host>
|
|
31
25
|
);
|
|
32
26
|
});
|
|
33
27
|
|
|
34
28
|
export const head: DocumentHead = ({ pathname }) => {
|
|
35
29
|
return {
|
|
36
|
-
title: pathname
|
|
30
|
+
title: `API: ${pathname}`,
|
|
37
31
|
};
|
|
38
32
|
};
|
|
@@ -3,14 +3,11 @@ import os from 'os';
|
|
|
3
3
|
|
|
4
4
|
export const onGet: EndpointHandler = ({ request }) => {
|
|
5
5
|
return {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
arch: os.arch(),
|
|
13
|
-
node: process.versions.node,
|
|
14
|
-
},
|
|
6
|
+
timestamp: Date.now(),
|
|
7
|
+
method: request.method,
|
|
8
|
+
url: request.url,
|
|
9
|
+
os: os.platform(),
|
|
10
|
+
arch: os.arch(),
|
|
11
|
+
node: process.versions.node,
|
|
15
12
|
};
|
|
16
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { component$, Host, useClientEffect$, useStore } from '@builder.io/qwik';
|
|
2
2
|
|
|
3
3
|
export default component$(() => {
|
|
4
|
-
const store = useStore({ timestamp:
|
|
4
|
+
const store = useStore({ timestamp: '', os: '', arch: '', node: '' });
|
|
5
5
|
|
|
6
6
|
useClientEffect$(async () => {
|
|
7
7
|
const url = `/api/builder.io/oss.json`;
|
|
@@ -28,9 +28,12 @@ export default component$(() => {
|
|
|
28
28
|
</ul>
|
|
29
29
|
|
|
30
30
|
<p>Timestamp: {store.timestamp}</p>
|
|
31
|
-
<p>
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
<p>
|
|
32
|
+
Node: <span>{store.node}</span>
|
|
33
|
+
</p>
|
|
34
|
+
<p>
|
|
35
|
+
OS: <span>{store.os}</span>
|
|
36
|
+
</p>
|
|
34
37
|
</Host>
|
|
35
38
|
);
|
|
36
39
|
});
|