Skip to content

Commit

Permalink
Updated routing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mqxx committed Oct 17, 2024
1 parent 3bdd95b commit 9e172b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/client/route/home/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Home</title>
<link rel="shortcut icon" href="./assets/favicon.svg" type="image/x-icon" />
<link rel="shortcut icon" href="./home/assets/favicon.svg" type="image/x-icon" />
</head>
<body>
<img src="/static/solidjs_logo.svg" alt="SolidJS Logo" />
Expand Down
12 changes: 6 additions & 6 deletions src/server/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { route, type Route } from "@std/http/unstable-route";
import { serveDir, serveFile } from "@std/http/file-server";
import { serveFile } from "@std/http/file-server";

const routes: Route[] = [
{
Expand All @@ -10,17 +10,17 @@ const routes: Route[] = [
)
},
{
pattern: new URLPattern({ pathname: '/(.+)' }),
handler: (request) => serveDir(
pattern: new URLPattern({ pathname: '/:page' }),
handler: (request, _info, parameters) => serveFile(
request,
{fsRoot: './dist/route/'}
`./dist/route/${parameters?.pathname.groups.page}/index.html`
)
},
{
pattern: new URLPattern({ pathname: '/' }),
handler: (request) => serveDir(
handler: (request) => serveFile(
request,
{fsRoot: './dist/route/home'}
`./dist/route/home/index.html`
)
}
];
Expand Down

0 comments on commit 9e172b6

Please sign in to comment.