mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-16 01:01:38 +00:00
update post fetcher
This commit is contained in:
@ -83,4 +83,4 @@ export const allPostsPath = async () => {
|
|||||||
export const readSinglePost = async (slug: string) => {
|
export const readSinglePost = async (slug: string) => {
|
||||||
const filename = path.join(`${dataPath}/${slug}.mdx`);
|
const filename = path.join(`${dataPath}/${slug}.mdx`);
|
||||||
return await fs.readFile(filename, { encoding: 'utf-8' });
|
return await fs.readFile(filename, { encoding: 'utf-8' });
|
||||||
};
|
};
|
9
lib/postsFetcher.ts
Normal file
9
lib/postsFetcher.ts
Normal file
@ -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();
|
||||||
|
};
|
Reference in New Issue
Block a user