Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshinorin committed Jan 1, 2024
1 parent 67eb496 commit 6726557
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
13 changes: 11 additions & 2 deletions src/app/feeds/index.xml/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,20 @@ import { getRequestContext } from '../../../utils/requestContext';
//export async function get(ctx: any) {
export async function GET() {
const response: Response = await getFeed(getRequestContext(headers()));
// ctx.res.statusCode = response.status; // TODO

if (response.status !== 200) {
return new Response(new Blob(), { status: 404 });
/* NOTE:
res.statusCode = response.status;
res.send;
*/
return new Response('', {
status: 404 ,
headers: {
"Content-Type": "text/xml",
},
});
}

let feedResponses = await response.json() as Array<Feed>;
const feeds = feedResponses.map(feed => {
return {
Expand Down
24 changes: 13 additions & 11 deletions src/app/sitemap.xml/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,24 @@ import { getSitemap } from '../../api/sitemap';
import { generateSitemapString } from '../../services/sitemap';
import { url } from '../../../config';
import { getRequestContext } from '../../utils/requestContext';
import { NextApiResponse } from 'next';

export async function GET() {
export async function GET(res: NextApiResponse) {
const response: Response = await getSitemap(getRequestContext(headers()));

/* TODO
ctx.res.statusCode = response.status;
let sitemapResponse = null;
if (response.status !== 200) {
return {
props: {
statusCode: 404
}
}
/* NOTE:
res.statusCode = response.status;
res.send;
*/
return new Response('', {
status: 404 ,
headers: {
"Content-Type": "text/xml",
},
});
}
*/

let sitemapResponse = await response.json() as Array<Sitemap>;
const sitemap = sitemapResponse.map(sitemap => {
return {
Expand Down

0 comments on commit 6726557

Please sign in to comment.