Skip to content

Commit 50280ab

Browse files
author
Invers3
committed
Update getPost.js
Testing
1 parent b77981d commit 50280ab

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

netlify/functions/getPost.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ exports.handler = async function(event){
88
const subject = event.queryStringParameters.name || 'post'
99
const postsDir = process.env.POSTS_DIR
1010
const postPath = path.join(postsDir, subject + '.json')
11+
const postContent = fs.readFileSync(postPath, 'utf8');
1112

1213
return {
1314
statusCode: 200,
14-
body: {
15-
out: postsDir
16-
}
15+
body: JSON.stringify(JSON.parse(postContent))
1716
};
1817

1918
} catch (error) {

0 commit comments

Comments
 (0)