1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-27 02:38:27 -04:00
jarv.is/pages/feed.xml.ts

21 lines
570 B
TypeScript

import { buildFeed } from "../lib/build-feed";
import type { GetServerSideProps } from "next";
export const getServerSideProps: GetServerSideProps = async (context) => {
const feed = buildFeed();
const { res } = context;
res.setHeader("content-type", "application/rss+xml; charset=utf-8");
// cache on edge for one hour
res.setHeader("cache-control", "s-maxage=3600, stale-while-revalidate");
res.write(feed.rss2());
res.end();
return {
props: {},
};
};
// eslint-disable-next-line import/no-anonymous-default-export
export default () => null;