Files
sapper-template/routes/blog/index.json.js
Rich Harris 6d86b00c26 move file
2018-06-28 13:24:06 -04:00

16 lines
263 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.writeHead(200, {
'Content-Type': 'application/json'
});
res.end(contents);
}