Add fetch post list

* add gray-matter
This commit is contained in:
Defectink
2022-03-22 17:03:35 +08:00
parent c651389aa3
commit 1179cc3c1f
9 changed files with 150 additions and 6 deletions

4
lib/utils/constant.ts Normal file
View File

@ -0,0 +1,4 @@
export const server =
process.env.NODE_ENV === 'development'
? 'http://localhost:3000'
: 'https://rua.plus';

12
lib/utils/index.ts Normal file
View File

@ -0,0 +1,12 @@
export const sortByDate = (
{ date: a }: { date: string },
{ date: b }: { date: string }
) => {
if (a < b) {
return 1;
} else if (a > b) {
return -1;
} else {
return 0;
}
};