summary refs log tree commit diff
path: root/lib/getPost.ts
blob: 2555215affb1452c3bb8f99c5a846f779bcfb269 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { parsePost } from "./parsePost";
import { Post } from "./interfaces";

interface getPostArgument {
  year: string;
  month: string;
  day: string;
  title: string;
}

export function getPost(
  { year, month, day, title }: getPostArgument,
  path: string
): Post {
  const filePath = `${path}/${year}/${month}/${day}/${title}.md`;

  const post = parsePost(filePath);
  return post;
}