mirror of
https://github.com/kevin-DL/sapper-template.git
synced 2026-01-13 18:55:23 +00:00
16 lines
268 B
JavaScript
16 lines
268 B
JavaScript
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.writeHead(200, {
|
|
'Content-Type': 'application/json'
|
|
});
|
|
|
|
res.end(contents);
|
|
} |