UNPKG

@indiekit/endpoint-webmention-io

Version:

Webmention.io endpoint for Indiekit. View webmentions collected by the Webmention.io service.

40 lines (32 loc) 776 B
import express from "express"; import { webmentionsController } from "./lib/controllers/webmentions.js"; const defaults = { mountPath: "/webmentions", token: process.env.WEBMENTION_IO_TOKEN, }; const router = express.Router(); export default class WebmentionEndpoint { constructor(options = {}) { this.name = "Webmention.io endpoint"; this.options = { ...defaults, ...options }; this.mountPath = this.options.mountPath; } get navigationItems() { return { href: this.options.mountPath, text: "webmention-io.title", }; } get routes() { router.get( "/", webmentionsController({ token: this.options.token, }), ); return router; } init(Indiekit) { Indiekit.addEndpoint(this); } }