import express from "express";
import React from "react";
import fs from "fs";
import ReactDOMServer from "react-dom/server";
import { Builder } from "xml2js";
import cryptoRandomString from "crypto-random-string";
export const webServer = express()
.use(express.static("static"))
.use(express.urlencoded({ extended: true }))
.get("/", (req, res) =>
res.send(
renderHtml(
Convert email newsletters into Atom feeds
Sign up for the newsletter with
{feedEmail(token)}
Subscribe to the Atom feed at
{feedUrl(token)}
Don’t share these addresses.
They contain a security token that other people could use
to send you spam and to control your newsletter subscriptions.
Enjoy your readings!
> ); } // https://validator.w3.org/feed/docs/atom.html // https://validator.w3.org/feed/#validate_by_input function Feed(inbox: Inbox) { const { name, token } = inbox; return { feed: { $: { xmlns: "http://www.w3.org/2005/Atom" }, link: [ { $: { rel: "self", type: "application/atom+xml", href: feedUrl(token) } }, { $: { rel: "alternate", type: "text/html", href: "https://www.kill-the-newsletter.com/" } } ], id: id(token), title: name, subtitle: `Kill the Newsletter! Inbox “${feedEmail(token)}”`, updated: now(), ...Entry({ title: `“${name}” Inbox Created`, author: "Kill the Newsletter!", content: ReactDOMServer.renderToStaticMarkup(