Download frontend/src/start.ts from StillWorking/Brain-Tumor-AI: direct link, hf CLI and curl.
- Browser
- Download file 944 Bytes
-
https://huggingface.co/datasets/StillWorking/Brain-Tumor-AI/resolve/main/frontend/src/start.ts
- Command line
-
hf download hf://datasets/StillWorking/Brain-Tumor-AI/frontend/src/start.ts
-
curl -L -o start.ts https://huggingface.co/datasets/StillWorking/Brain-Tumor-AI/resolve/main/frontend/src/start.ts
944 Bytes
| import { createStart, createCsrfMiddleware, createMiddleware } from "@tanstack/react-start"; | |
| import { renderErrorPage } from "./lib/error-page"; | |
| const errorMiddleware = createMiddleware().server(async ({ next }) => { | |
| try { | |
| return await next(); | |
| } catch (error) { | |
| if (error != null && typeof error === "object" && "statusCode" in error) { | |
| throw error; | |
| } | |
| console.error(error); | |
| return new Response(renderErrorPage(), { | |
| status: 500, | |
| headers: { "content-type": "text/html; charset=utf-8" }, | |
| }); | |
| } | |
| }); | |
| // Start installs this automatically when src/start.ts is absent; defining the | |
| // file opts out, so re-add it explicitly to keep server functions protected | |
| // from cross-site requests. | |
| const csrfMiddleware = createCsrfMiddleware({ | |
| filter: (ctx) => ctx.handlerType === "serverFn", | |
| }); | |
| export const startInstance = createStart(() => ({ | |
| requestMiddleware: [errorMiddleware, csrfMiddleware], | |
| })); | |