Public
markdownBlogStarter
Viewing readonly version: 34View latest version
HTTP
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const DIR_NAME = "posts";
const ESM_TOWM_PREFIX = import.meta.url.substring(0, import.meta.url.lastIndexOf("/"));
interface Post {
relativePath: string;
esmPath: string;
title: string;
content: string;
}
// Retrieves all posts in the posts/ folder
function getPosts(): Post[] {
// Looks for all posts in the posts folder
// one by one, by the pattern post-1.md, post-2.md, until it gets a 404
const posts = [];
const i = 1;
let post = getPost(1);
while (post) {
posts.push(post);
i++;
post = getPost(i);
}
}
export default async function(req: Request): Promise<Response> {
return Response.json({ ok: true });
}
H
index.ts