Urigo / SOFA

The best way to create REST APIs - Generate RESTful APIs from your GraphQL Server

Home Page:https://www.the-guild.dev/graphql/sofa-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

useSofa typings are not compatible with express

imwexpex opened this issue · comments

Good day, looks like SOFA is not compatible with express (anymore?)

I'm receiving TS error:
Argument of type 'Router<DefaultSofaServerContext>' is not assignable to parameter of type 'Application<Record<string, any>>'.

Minimum repro example: https://stackblitz.com/edit/graphql-dugtqd

It seems a TS issue more than a functional issue. Until it gets fixed, you can add as any after useSofa call to make it work. Also if you use Yoga, you can try SOFA plugin which allows you to share the same setup between SOFA and Yoga;
https://the-guild.dev/graphql/yoga-server/docs/features/sofa-api

It seems a TS issue more than a functional issue. Until it gets fixed, you can add as any after useSofa call to make it work. Also if you use Yoga, you can try SOFA plugin which allows you to share the same setup between SOFA and Yoga; https://the-guild.dev/graphql/yoga-server/docs/features/sofa-api

Hey! Thanks for a reply

  1. Yoga was used just for example, on the main project, I'm using Apollo
  2. Unfortunately, it's not only TS issue. It's functional also, can't set up SOFA to work with express. Do you have any working examples?

It works with as any;
https://stackblitz.com/edit/graphql-uwzf28?file=index.ts
So you can check /api/hello.

It works with as any; https://stackblitz.com/edit/graphql-uwzf28?file=index.ts So you can check /api/hello.

My bad, you're right. so looks like I should dig deeper into why in my project SOFA doesn't work

Fixed in the latest version!