Skip to content

Commit 92512a0

Browse files
author
Invers3
committed
Update getPosts.js
Added posts
1 parent 6393d98 commit 92512a0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

netlify/functions/getPosts.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ exports.handler = async function(){
88
const postsDir = path.join(__dirname, '_posts');
99
const files = fs.readdirSync('/');
1010

11-
/*const posts = files.filter(file => file.endsWith('.json')).map(file => {
12-
const content = fs.readFileSync(path.join(postsDir, file), 'utf-8');
13-
return JSON.parse(content);
14-
});*/
11+
const posts = files.map(file => {
12+
return {
13+
out: postsDir + file
14+
};
15+
});
1516

1617
return {
1718
statusCode: 200,
18-
body: postsDir
19+
body: posts
1920
};
2021

2122
} catch (error) {

0 commit comments

Comments
 (0)