Initial export from WebStudio.is
This commit is contained in:
24
app/routes/[_image].$.ts
Normal file
24
app/routes/[_image].$.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { env } from "node:process";
|
||||
import type { LoaderFunctionArgs } from "react-router";
|
||||
import {
|
||||
createIPX,
|
||||
createIPXH3Handler,
|
||||
ipxFSStorage,
|
||||
ipxHttpStorage,
|
||||
} from "ipx";
|
||||
import { createApp, toWebHandler } from "h3";
|
||||
|
||||
const domains = env.DOMAINS?.split(/\s*,\s*/) ?? [];
|
||||
|
||||
const ipx = createIPX({
|
||||
storage: ipxFSStorage({ dir: "./public" }),
|
||||
httpStorage: ipxHttpStorage({ domains }),
|
||||
});
|
||||
|
||||
const handleRequest = toWebHandler(
|
||||
createApp().use("/_image", createIPXH3Handler(ipx))
|
||||
);
|
||||
|
||||
export const loader = async (args: LoaderFunctionArgs) => {
|
||||
return handleRequest(args.request);
|
||||
};
|
||||
Reference in New Issue
Block a user