website/routes/api/news/fetchAll.ts

15 lines
373 B
TypeScript
Raw Normal View History

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