summary refs log tree commit diff
path: root/lib/getPost.ts
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2019-10-14 09:47:28 +0200
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2019-10-14 09:47:51 +0200
commit49e82e812812ba75175d98173379d2e416e17b8f (patch)
treef67bdcffce9aca8a76b534124a0eabbe85658768 /lib/getPost.ts
parent262ebdc07892f3c892d4831c276444df6f6e22f1 (diff)
downloadkronikarz-49e82e812812ba75175d98173379d2e416e17b8f.tar.gz
kronikarz-49e82e812812ba75175d98173379d2e416e17b8f.zip
Add getPost
Diffstat (limited to 'lib/getPost.ts')
-rw-r--r--lib/getPost.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/getPost.ts b/lib/getPost.ts
new file mode 100644
index 0000000..2555215
--- /dev/null
+++ b/lib/getPost.ts
@@ -0,0 +1,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;
+}