make project exportable by avoiding api/blog route conflict

This commit is contained in:
Rich Harris
2018-02-05 09:09:32 -05:00
parent c4181157dd
commit c84ae160ef
4 changed files with 4 additions and 4 deletions

16
routes/api/blog-posts.js Normal file
View File

@@ -0,0 +1,16 @@
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.set({
'Content-Type': 'application/json'
});
res.end(contents);
}