UNPKG

@indiekit/endpoint-syndicate

Version:

Syndication endpoint for Indiekit. Provides an endpoint you can ping to check that recently published posts have been posted to configured syndication targets.

29 lines (21 loc) 698 B
import express from "express"; import { syndicateController } from "./lib/controllers/syndicate.js"; const defaults = { mountPath: "/syndicate" }; const router = express.Router(); export default class SyndicateEndpoint { constructor(options = {}) { this.name = "Syndication endpoint"; this.options = { ...defaults, ...options }; this.mountPath = this.options.mountPath; } get routesPublic() { router.post("/", syndicateController.post); return router; } init(Indiekit) { Indiekit.addEndpoint(this); // Use private value to register syndication endpoint path Indiekit.config.application._syndicationEndpointPath = this.options.mountPath; } }