import { Hono } from 'hono';
import { Home } from '@blog/templates/Pages/Home';
import { getPostList } from '@blog/post/post-reader';
import { PostMeta } from '@blog/model/PostMeta';

const app = new Hono();

app.get('/', async (c) => {
  const postDir = __dirname + '/../../posts';
  const postList: PostMeta[] = await getPostList(postDir);

  return c.render(<Home posts={postList}/>, { meta: { 
    description: "The blog for Dave Smith-Hayes, a dad and developer."  
  }});
});

export default app;
