switch to [slug].json.js server routes, instead of /api/...

This commit is contained in:
Rich Harris
2018-03-03 21:39:28 -05:00
parent e5d3589b63
commit 6a286f470d
5 changed files with 5 additions and 5 deletions

16
routes/blog.json.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);
}