Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import type { EntryContext } from "react-router";
|
||||
import { getSitemapXml } from "./utils/sitemap.server";
|
||||
|
||||
type Handler = (request: Request, remixContext: EntryContext) => Promise<Response | null> | null;
|
||||
|
||||
const pathedRoutes: Record<string, Handler> = {
|
||||
"/sitemap.xml": async (request, remixContext) => {
|
||||
const sitemap = await getSitemapXml(request, remixContext);
|
||||
return new Response(sitemap, {
|
||||
headers: {
|
||||
"Content-Type": "application/xml",
|
||||
"Content-Length": String(Buffer.byteLength(sitemap)),
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
const routes: Array<Handler> = [
|
||||
...Object.entries(pathedRoutes).map(([path, handler]) => {
|
||||
return (request: Request, remixContext: EntryContext) => {
|
||||
if (new URL(request.url).pathname !== path) return null;
|
||||
|
||||
return handler(request, remixContext);
|
||||
};
|
||||
}),
|
||||
];
|
||||
|
||||
export { routes, pathedRoutes };
|
||||
Reference in new issue
Block a user