Skip to content

Commit 308899c

Browse files
committed
refactor
1 parent 8764260 commit 308899c

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

config/build/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const filesConfig : esbuild.BuildOptions = {
5151
tsconfig: './deno.json',
5252
outdir: './dist',
5353
outbase: './src/client',
54-
entryNames: '[dir]/bundle.min',
54+
entryNames: '[dir]/bundle',
5555
entryPoints: [
5656
'./src/client/app/**/index.tsx',
5757
'./src/client/app/**/index.scss',

src/client/app/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Home</title>
7-
<link rel="shortcut icon" href="/assets/favicon.svg" type="image/x-icon" />
8-
<link rel="stylesheet" href="/bundle.min.css" />
7+
<link rel="shortcut icon" href="./assets/favicon.svg" type="image/x-icon" />
8+
<link rel="stylesheet" href="/bundle.css" />
99
</head>
1010
<body>
1111
<h1 class="title">Home</h1>

src/server/index.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,22 @@ const routes: Route[] = [
1515
)
1616
},
1717
{
18-
pattern: new URLPattern({ pathname: '/:path*/assets/:dynamicAsset*' }),
18+
pattern: new URLPattern({ pathname: '/:asset' }),
1919
handler: (request, _info, parameters) => {
20-
const {path, dynamicAsset} = parameters?.pathname.groups ?? {};
20+
const {asset} = parameters?.pathname.groups ?? {};
2121
return pageHandler(
2222
request,
2323
appDirectory,
24-
path,
25-
'/assets/' + dynamicAsset
24+
'',
25+
asset
2626
);
2727
}
2828
},
2929
{
30-
pattern: new URLPattern({ pathname: '/:path(.*)' }),
31-
handler: (request) => {
30+
pattern: new URLPattern({ pathname: '/:page([^\.]*)' }),
31+
handler: (request, _info, parameters) => {
32+
console.log('page', parameters?.pathname.groups.page);
33+
3234
return pageHandler(request, appDirectory, '')
3335
}
3436
}

0 commit comments

Comments
 (0)