UNPKG

323 BPlain TextView Raw
1import { Server } from '../types/fastify'
2import Thread from '../types/Thread'
3
4function thread ({ name, id, isGroup }: Thread) {
5 return { name, id, isGroup }
6}
7
8export default async (app: Server) => {
9 app.get('/threads', async (request, reply) => {
10 return Array.from(messenger.threads.values()).map(thread)
11 })
12}