initial commit

This commit is contained in:
Rich Harris
2017-12-17 14:47:18 -05:00
commit 600360665d
27 changed files with 893 additions and 0 deletions

17
routes/api/blog/index.js Normal file
View File

@@ -0,0 +1,17 @@
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);
}