From 4e5a72df99a7f78b67971cc93fef1c4a3663ef92 Mon Sep 17 00:00:00 2001 From: DefectingCat Date: Thu, 18 May 2023 09:55:23 +0800 Subject: [PATCH] update post fetcher --- lib/posts.ts | 2 +- lib/postsFetcher.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 lib/postsFetcher.ts diff --git a/lib/posts.ts b/lib/posts.ts index cbb60fb..03f261a 100644 --- a/lib/posts.ts +++ b/lib/posts.ts @@ -83,4 +83,4 @@ export const allPostsPath = async () => { export const readSinglePost = async (slug: string) => { const filename = path.join(`${dataPath}/${slug}.mdx`); return await fs.readFile(filename, { encoding: 'utf-8' }); -}; +}; \ No newline at end of file diff --git a/lib/postsFetcher.ts b/lib/postsFetcher.ts new file mode 100644 index 0000000..2cab125 --- /dev/null +++ b/lib/postsFetcher.ts @@ -0,0 +1,9 @@ +const baseUrl = 'https://blog-backend-beige-pi.vercel.app/'; + +/** + * Read post meta info from backend + */ +const readFileMate = async (filename: string) => { + const target = `${baseUrl}/${filename}.mdx`; + const result = await (await fetch(target)).text(); +}; \ No newline at end of file