pinafore/routes/api/blog/index.js
2018-01-06 15:51:25 -08:00

16 lines
No EOL
252 B
JavaScript

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);
}