2024-07-03 02:35:01 +00:00
|
|
|
import { Hono } from 'hono';
|
|
|
|
import { jsxRenderer, useRequestContext } from 'hono/jsx-renderer';
|
|
|
|
import { Page } from '@blog/templates/Page';
|
2024-07-04 00:18:40 +00:00
|
|
|
import { renderHomePage } from '@blog/routes/home';
|
|
|
|
import { renderPostPage } from '@blog/routes/post';
|
2024-07-03 02:35:01 +00:00
|
|
|
|
|
|
|
const app = new Hono();
|
|
|
|
|
|
|
|
app.get(
|
|
|
|
'*',
|
|
|
|
jsxRenderer(
|
|
|
|
({ children }) => {
|
|
|
|
return (<Page>{children}</Page>);
|
|
|
|
},
|
|
|
|
{
|
|
|
|
docType: true
|
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
// read all posts
|
|
|
|
// create listing of posts
|
|
|
|
|
|
|
|
app.get('/', async (c) => {
|
2024-07-04 00:18:40 +00:00
|
|
|
return renderHomePage(c);
|
2024-07-03 02:35:01 +00:00
|
|
|
});
|
|
|
|
|
2024-07-03 02:52:56 +00:00
|
|
|
app.get('/posts/:slug', async (c) => {
|
2024-07-04 00:18:40 +00:00
|
|
|
return renderPostPage(c);
|
2024-07-03 02:35:01 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
export default app;
|