diff --git a/routes/api/news/fetchAll.ts b/routes/api/news/fetchAll.ts new file mode 100644 index 0000000..ff56fe0 --- /dev/null +++ b/routes/api/news/fetchAll.ts @@ -0,0 +1,14 @@ +import { fetchNewsList } from ':src/blog/mod.ts' +import { SessionHandlers } from ':src/session/mod.ts' +import { respondApi, respondApiStream } from ':src/utils.ts' + +export const handler: SessionHandlers = { + GET() { + try { + const newsList = fetchNewsList('cohabit') + return respondApiStream(newsList) + } catch (error) { + return respondApi('error', error) + } + }, +}