feat(api): add news fetching api handler

This commit is contained in:
Julien Oculi 2024-07-02 13:03:09 +02:00
parent 5365f11ec6
commit f2c8b145e6

View file

@ -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)
}
},
}