공부 중 다음카페 인기글 api를 가져오려는데 CORS에러가 발생했다.
검색 후 아래와 같이 next.config.js에 간단하게 작성해주니 문제가 해결되었다.
// next.config.js
const nextConfig = {
...
async rewrites() {
return [
{
source: "/daumcafe/:path*",
destination: `https://top.cafe.daum.net/_c21_/api/v3/:path*`,
},
];
},
};
module.exports = nextConfig;