14 lines
393 B
TypeScript
14 lines
393 B
TypeScript
import { Hono } from 'hono';
|
|
import { readdir } from 'node:fs/promises';
|
|
import { Home } from '@blog/templates/Pages/Home';
|
|
|
|
const app = new Hono();
|
|
|
|
app.get('/', async (c) => {
|
|
const files: string[] = await readdir(__dirname + '/../../posts', { recursive: true });
|
|
const posts: string[] = files.map(f => f.slice(0, -3));
|
|
return c.render(<Home posts={posts}/>);
|
|
});
|
|
|
|
export default app;
|