Files
sapper/test/app/routes/api/blog/contents.js
Rich Harris d457af8d51 update test
2018-01-14 18:14:07 -05:00

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