import express, { Router } from "express"; import { Database } from "sqlite3"; const domain = process.env.DOMAIN; export default function followers(router: Router) { router.get("/ap/actor/followers", (req, res) => { const db = req.app.get("db"); db.all("SELECT id FROM followers", (err, rows) => { res.json({ "@context": [ "https://www.w3.org/ns/activitystreams" ], "type": "OrderedCollection", "id": `https://${domain}/ap/actor/followers`, "totalItems": rows.length, "items": rows.map(row => row.id) }); res.end(); }); }); }