fix: json feeds
This commit is contained in:
parent
cbdc98274e
commit
012a6b88c7
5 changed files with 35 additions and 10 deletions
|
@ -4,7 +4,7 @@ import { fetchActivity } from "@utils/data/activity.js";
|
||||||
|
|
||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function GET() {
|
||||||
const globals = await fetchGlobals();
|
const globals = await fetchGlobals();
|
||||||
const activity = await fetchActivity();
|
const activity = await fetchActivity();
|
||||||
|
|
||||||
|
@ -19,5 +19,10 @@ export async function getStaticPaths() {
|
||||||
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
||||||
await fs.writeFile(filePath, feed);
|
await fs.writeFile(filePath, feed);
|
||||||
|
|
||||||
return [];
|
return new Response(feed, {
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { fetchBooks } from "@utils/data/books.js";
|
||||||
|
|
||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function GET() {
|
||||||
const globals = await fetchGlobals();
|
const globals = await fetchGlobals();
|
||||||
const books = await fetchBooks();
|
const books = await fetchBooks();
|
||||||
|
|
||||||
|
@ -19,5 +19,10 @@ export async function getStaticPaths() {
|
||||||
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
||||||
await fs.writeFile(filePath, feed);
|
await fs.writeFile(filePath, feed);
|
||||||
|
|
||||||
return [];
|
return new Response(feed, {
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { fetchLinks } from "@utils/data/links.js";
|
||||||
|
|
||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function GET() {
|
||||||
const globals = await fetchGlobals();
|
const globals = await fetchGlobals();
|
||||||
const links = await fetchLinks();
|
const links = await fetchLinks();
|
||||||
|
|
||||||
|
@ -19,5 +19,10 @@ export async function getStaticPaths() {
|
||||||
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
||||||
await fs.writeFile(filePath, feed);
|
await fs.writeFile(filePath, feed);
|
||||||
|
|
||||||
return [];
|
return new Response(feed, {
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { fetchMovies } from '@utils/data/movies';
|
||||||
|
|
||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function GET() {
|
||||||
const globals = await fetchGlobals();
|
const globals = await fetchGlobals();
|
||||||
const movies = await fetchMovies();
|
const movies = await fetchMovies();
|
||||||
|
|
||||||
|
@ -19,5 +19,10 @@ export async function getStaticPaths() {
|
||||||
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
||||||
await fs.writeFile(filePath, feed);
|
await fs.writeFile(filePath, feed);
|
||||||
|
|
||||||
return [];
|
return new Response(feed, {
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { fetchAllPosts } from "@utils/data/posts.js";
|
||||||
|
|
||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function GET() {
|
||||||
const globals = await fetchGlobals();
|
const globals = await fetchGlobals();
|
||||||
const posts = await fetchAllPosts();
|
const posts = await fetchAllPosts();
|
||||||
|
|
||||||
|
@ -19,5 +19,10 @@ export async function getStaticPaths() {
|
||||||
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
||||||
await fs.writeFile(filePath, feed);
|
await fs.writeFile(filePath, feed);
|
||||||
|
|
||||||
return [];
|
return new Response(feed, {
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue