import posts from './blog/_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', 'Cache-Control': `max-age=${30 * 60 * 1e3}` // cache for 30 minutes }); res.end(contents); }