aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/feed.json.ts
blob: e155022254865807aa2e133d0911a63595745230 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import type { GetServerSideProps } from 'next';
import { generateFeed } from '../utils/helpers';

const Feed = () => null;

export const getServerSideProps: GetServerSideProps = async ({ res }) => {
  const feed = await generateFeed();

  res.setHeader(
    'Cache-Control',
    'public, s-maxage=600, stale-while-revalidate=59'
  );
  res.setHeader('Content-Type', 'application/json');
  res.write(feed.json1());
  res.end();

  return {
    props: {},
  };
};

export default Feed;