diff --git a/src/assets/main.css b/src/assets/main.css new file mode 100644 index 0000000..fdcf84e --- /dev/null +++ b/src/assets/main.css @@ -0,0 +1,2 @@ +/* Do something */ + diff --git a/src/config.ts b/src/config.ts index aa64bb2..d8809fc 100644 --- a/src/config.ts +++ b/src/config.ts @@ -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'; diff --git a/src/index.tsx b/src/index.tsx index 72883b3..4c7528f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -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); diff --git a/src/templates/Page.tsx b/src/templates/Page.tsx index 2ee969d..7ed6b75 100644 --- a/src/templates/Page.tsx +++ b/src/templates/Page.tsx @@ -13,6 +13,7 @@ export function Page({ children, meta }: { children: any, meta: SiteMeta }) {