import { HttpApi, HttpApiBuilder, HttpApiEndpoint, HttpApiGroup } from "@effect/platform";
import { Schema } from "@effect/schema";
import { Chunk, Effect, Layer, Stream } from "effect";
const applicationsApi = HttpApiGroup.make("applications").pipe(
HttpApiGroup.add(
HttpApiEndpoint.get("getStream", "/stream").pipe(HttpApiEndpoint.setSuccess(
// ??? what is the schema here
),
),
);
class API extends HttpApi.empty.pipe(HttpApi.addGroup(applicationsApi)) {}
const applicationsApiLive = HttpApiBuilder.group(API, "applications", (handlers) =>
// Am I returning a stream correctly?
handlers.pipe(HttpApiBuilder.handle("getStream", () => Effect.succeed(Stream.fromChunk(Chunk.of("Hello, World!"))))),
);
export const apiLive = HttpApiBuilder.api(API).pipe(Layer.provide(applicationsApiLive));
import { HttpApi, HttpApiBuilder, HttpApiEndpoint, HttpApiGroup } from "@effect/platform";
import { Schema } from "@effect/schema";
import { Chunk, Effect, Layer, Stream } from "effect";
const applicationsApi = HttpApiGroup.make("applications").pipe(
HttpApiGroup.add(
HttpApiEndpoint.get("getStream", "/stream").pipe(HttpApiEndpoint.setSuccess(
// ??? what is the schema here
),
),
);
class API extends HttpApi.empty.pipe(HttpApi.addGroup(applicationsApi)) {}
const applicationsApiLive = HttpApiBuilder.group(API, "applications", (handlers) =>
// Am I returning a stream correctly?
handlers.pipe(HttpApiBuilder.handle("getStream", () => Effect.succeed(Stream.fromChunk(Chunk.of("Hello, World!"))))),
);
export const apiLive = HttpApiBuilder.api(API).pipe(Layer.provide(applicationsApiLive));