pinafore/routes/api/blog/index.js

16 lines
252 B
JavaScript
Raw Normal View History

2018-01-07 00:51:25 +01:00
import posts from './_posts.js';
const contents = JSON.stringify(posts.map(post => {
return {
title: post.title,
slug: post.slug
};
}));
export function get(req, res) {
res.set({
'Content-Type': 'application/json'
});
res.end(contents);
}