1import * as Fly from "@/Fly";
2import type { ServiceProps } from "@/Fly/Service";
3import * as pathe from "pathe";
4
5/** Body served by `echo-server.ts`. */
6export const ECHO_BODY = "fly-echo";
7
8/**
9 * An external Service running `echo-server.ts` on port 3000. Set
10 * `env.ECHO_BODY` to change the response body.
11 */
12export const Echo = (
13 options: Partial<Omit<ServiceProps, "main">> = {},
14 id = "Echo",
15) =>
16 Fly.Service(id, {
17 main: pathe.resolve(import.meta.dirname, "echo-server.ts"),
18 port: 3000,
19 region: "iad",
20 ...options,
21 });