mirror of
https://github.com/kevin-DL/sapper-template.git
synced 2026-01-18 20:55:05 +00:00
make project exportable by avoiding api/blog route conflict
This commit is contained in:
16
routes/api/blog-posts.js
Normal file
16
routes/api/blog-posts.js
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user