Created
May 6, 2021 12:43
-
-
Save mktakuya/5cc314d778271cf67d1778fe6da0773c to your computer and use it in GitHub Desktop.
api.yuru28.com/feed にあるRSSフィードを、 yuru28.com/feed でそのままプロキシするNext.jsのコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { GetServerSidePropsContext } from "next" | |
export async function getServerSideProps({ res }: GetServerSidePropsContext) { | |
const feedUrl = "https://api.yuru28.com/feed" | |
await fetch(feedUrl) | |
.then((response) => response.text()) | |
.then((data) => { | |
res.statusCode = 200 | |
res.setHeader("Content-Type", "application/xml") | |
res.end(data) | |
}) | |
return { | |
props: {}, | |
} | |
} | |
const Page = () => null | |
export default Page |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment