Some reason the serveStatic isn't serving static.

This commit is contained in:
Dave Smith-Hayes 2024-07-30 20:15:10 -04:00
parent ecbfbd31de
commit 57620a2404
4 changed files with 8 additions and 1 deletions

2
src/assets/main.css Normal file
View File

@ -0,0 +1,2 @@
/* Do something */

View File

@ -1,4 +1,4 @@
export const POST_PATH: string = __dirname + '/../posts';
export const STATIC_PATH: string = __dirname + '/../static';
export const STATIC_PATH: string = __dirname + '/assets';
export const POST_ROUTE_PREFIX: string = '/posts'
export const SQLITE_DATABASE_FILE: string = __dirname + '/../db/blog.sqlite';

View File

@ -1,11 +1,13 @@
import { Hono } from 'hono';
import { jsxRenderer } from 'hono/jsx-renderer';
import { serveStatic } from 'hono/bun';
import { Page } from '@blog/templates/Page';
import home from '@blog/handlers/home';
import posts from '@blog/handlers/posts';
import type { SiteMeta } from '@blog/models/SiteMeta';
import { postFileMiddleware } from '@blog/middleware/post-service';
import { logger } from 'hono/logger';
import { STATIC_PATH } from '@blog/config';
declare module 'hono' {
interface ContextRenderer {
@ -27,6 +29,8 @@ app.get(
)
);
app.get('/static/*', serveStatic({ root: "./assets/" }));
console.log(JSON.stringify({ message: "Bootstrapping the routes..." }));
app.route('/', home);
app.route('/posts', posts);

View File

@ -13,6 +13,7 @@ export function Page({ children, meta }: { children: any, meta: SiteMeta }) {
<title>davesmithhayes.com</title>
<MetaTags meta={meta} />
<Style />
<link rel="stylesheet" href="/static/main.css" />
</head>
<body>
<header>