Compile error in `app.pipe` while creating server with effect-http

[SOLVED]
I'm creating a server with effect-http (it includes usecases used in routes and repos). But I have one compile error in app.pipe

import { RepoAuthor, SqlLive } from '@journals/adapters/repositories'
import { api } from './api'
import { appError, loggerDebug } from './utils'

export const app = Effect.gen(function* () {
    const repoAuthor = yield* RepoAuthor

    return RouterBuilder.make(api).pipe(
        RouterBuilder.handle('addAuthor', ({ body }) =>
            Effect.gen(function* () {
                return yield* repoAuthor.addAuthor(body)
            }).pipe(Effect.withSpan('addAuthor'), appError('could not add author')),
        ),
        RouterBuilder.handle('deleteAuthor', ({ body }) =>
            Effect.gen(function* () {
                return yield* repoAuthor.deleteAuthor(body)
            }).pipe(
                Effect.withSpan('deleteAuthor'),
                appError('could not delete author'),
            ),
        ),
        RouterBuilder.handle('getAuthor', ({ query }) =>
            Effect.gen(function* () {
                return yield* repoAuthor.getAuthor(query)
            }).pipe(Effect.withSpan('getAuthor'), appError('could not get author')),
        ),
        RouterBuilder.handle('updateAuthor', ({ body, path }) =>
            Effect.gen(function* () {
                return yield* repoAuthor.updateAuthor(path.authorId, body)
            }).pipe(
                Effect.withSpan('updateAuthor'),
                appError('could not update author'),
            ),
        ),
        RouterBuilder.build,
        Middlewares.errorLog,
    )
})

const program = app.pipe(
    Effect.tap(Effect.logInfo('Server docs at http://localhost:4000/docs#/')),
Effect.provide(SqlLive.pipe(Layer.provide(DevTools.layer()))),
    Effect.provide(RepoAuthor.Live),
    NodeServer.listen({ port: 4000 }),
    Effect.tapErrorCause(Effect.logError),
    Effect.provide(loggerDebug),
)

NodeRuntime.runMain(program)
Was this page helpful?