Effect CommunityEC
Effect Community7mo ago
1 reply
Jambudipa

How to Type an `HttpApi` in Effect Typescript Library?

Hello all...so how can I type my
HttpApi
? I am beginning to think it is not possible,
export const mpApi = HttpApi.make('myApi').add(
  HttpApiGroup.make('chat')
    .add(
      HttpApiEndpoint.get('getStream', '/stream')
        .setUrlParams(
          Schema.Struct({
            message: Schema.String,
            threadId: Schema.optional(Schema.String)
          })
        )
        .addSuccess(
          Schema.String.pipe( // <!-- this, not really adequate
            HttpApiSchema.withEncoding({
              kind: 'Text',
              contentType: 'application/x-ndjson'
            })
          )
        )
    )
  )
)
Was this page helpful?