We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6393d98 commit 92512a0Copy full SHA for 92512a0
netlify/functions/getPosts.js
@@ -8,14 +8,15 @@ exports.handler = async function(){
8
const postsDir = path.join(__dirname, '_posts');
9
const files = fs.readdirSync('/');
10
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
- });*/
+ const posts = files.map(file => {
+ return {
+ out: postsDir + file
+ };
15
+ });
16
17
return {
18
statusCode: 200,
- body: postsDir
19
+ body: posts
20
};
21
22
} catch (error) {
0 commit comments