sailfork / t3code-github / .repos/ alchemy-effect/ packages/ integration-tests/ test/ Fly/ fixtures/ echo.ts

import * as Fly from "@alchemy.run/fly";
import type { ServiceProps } from "@alchemy.run/fly/Service";
import * as pathe from "pathe";

/** Body served by `echo-server.ts`. */
export const ECHO_BODY = "fly-echo";

/**
 * An external Service running `echo-server.ts` on port 3000. Set
 * `env.ECHO_BODY` to change the response body.
 */
export const Echo = (options: Partial<Omit<ServiceProps, "main">> = {}, id = "Echo") =>
  Fly.Service(id, {
    main: pathe.resolve(import.meta.dirname, "echo-server.ts"),
    port: 3000,
    region: "iad",
    ...options,
  });