INNER CODE UNIT · TypeScript

text

runvendo/vendo · corpus/hosts/express-host/src/server/index.ts:31

function text(value: unknown): string | undefined {
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
}

export function createRelayServer(options: RelayServerOptions = {}): RelayServer {
  const app = express();
  const tasks = options.tasks ?? new TaskStore();
  const vendo = createRelayVendo({
    ...(options.model === undefined ? {} : { model: options.model }),
    ...(options.store === undefined ? {} : { store: options.store }),
  });

  app.disable("x-powered-by");
  app.use("/api/vendo", (req, res, next) => {
    void serveFetchHandler(req, res, vendo.handler).catch((error: unknown) => {
      if (res.headersSent) res.destroy(error instanceof Error ? error : undefined);
      else next(error);
    });

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…