Skip to content

Commit 9cb8a75

Browse files
author
Invers3
committed
Update netlify functions
Added
1 parent 84e0c21 commit 9cb8a75

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

netlify/functions/getPosts.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ exports.handler = async function(){
55

66
try {
77

8-
/*const postsDir = path.join(process.cwd(), '_posts');
9-
/*const files = fs.readdirSync(postsDir);
8+
const postsDir = path.join(__dirname, '_posts');
9+
const files = fs.readdirSync(postsDir);
1010

1111
const posts = files.filter(file => file.endsWith('.json')).map(file => {
1212
const content = fs.readFileSync(path.join(postsDir, file), 'utf-8');
1313
return JSON.parse(content);
14-
});*/
14+
});
1515

1616
return {
1717
statusCode: 200,
18-
body: process.cwd() + '_posts'
18+
body: path.join(process.cwd(), '_posts')
1919
};
2020

2121
} catch (error) {

0 commit comments

Comments
 (0)