Customize Endpoint's HTTP Method

Customize your GraphQL endpoint's HTTP method with Sofa. Learn how to easily switch between GET and POST using the routes parameter for specific queries or mutations. #GraphQL #Sofa

Sofa allows you to customize the http method. For example, in case you need POST instead of GET method in one of your query, you do the following:

api.use(
  '/api',
  useSofa({
    schema,
    routes: {
      'Query.feed': { method: 'POST' },
    },
  })
);

When Sofa tries to define a route for feed of Query, instead of exposing it under GET (default for Query type) it will use POST method.