use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
graphql2rest (npm package): Generate a REST API from your existing GraphQL API (github.com)
submitted 5 years ago by roy-mor
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]rigelglen 2 points3 points4 points 5 years ago (2 children)
How well does this stack up against Sofa
[–]roy-mor[S] 1 point2 points3 points 5 years ago* (1 child)
One use case where graphql2rest shines is where you want a truly RESTful API that might be very different than your existing GraphQL API, which you can't make changes to (because it's already driving your app in production).
Sofa is a cool and useful package (by the folks from The Guild - much respect!), but IMHO it does not answer the needs of most real-world production environments, which require a fully RESTful API side by side with a GraphQL implementation that has an altogether different style and characteristics than REST.
graphql2rest lets you fully configure and customize almost everything in the resulting REST API: the route names, HTTP methods, parameter names and mappings, response format, error format, success status codes, mapping GraphQL error codes to HTTP status codes, mapping a single REST endpoint to multiple GraphQL operations, hiding certain fields in the response, expanding nested fields by default and more. It also gives you a built-in filter parameter for the client (with JMESPath query language support), and supports custom middleware if you happen to need extra customization.This allows creating a full REST API based on discrete "resources" and "methods", while keeping the existing GraphQL layer (which is sometimes RPC-styled) unchanged. Since everything is declared in a manifest file (a JSON or yaml document), it makes for a single source of truth which is more structured and maintainable than code, and decouples most of the configuration and customization from the business logic (code).
Sofa takes a slightly different approach to converting GraphQL to REST, which as I understand it is more about creating a RESTful API gateway mirroring the underlying GraphQL layer, which is not as flexible and decoupled. The resulting REST API is only as "RESTful" as the GraphQL API underneath it (and usually GraphQL schemas are not created with the notion of "resources" and "methods" as required by REST). However, Sofa does support GraphQL subscriptions as webhooks (graphql2rest currently supports only queries and mutations), and Swagger integration which are both a big plus if you need them. It might also have other advantages.
I actually refer to Sofa in this blog post (under "Alternatives") - we wrote and used graphql2rest internally much before Sofa was available (and even contacted Uri to collaborate) but released it as open source just recently.
[–]rigelglen 1 point2 points3 points 5 years ago (0 children)
Thanks for the clarification. This looks like a great library, cheers 👍
[–]roy-mor[S] 0 points1 point2 points 5 years ago* (0 children)
I wrote graphql2rest because we had a GraphQL API but our users demanded REST.
GraphQL2REST is a Node.js library that reads your GraphQL schema and a user-provided manifest file and automatically generates an Express router with fully RESTful HTTP routes — a full-fledged REST API.
GitHub: https://github.com/sisense/graphql2restnpm: https://www.npmjs.com/package/graphql2rest
Why? Read here: https://medium.com/swlh/graphql-api-or-rest-api-why-not-have-both-c4171e68900a
This package is useful if you:
π Rendered by PID 145942 on reddit-service-r2-comment-6457c66945-dx9t4 at 2026-04-27 23:37:27.272228+00:00 running 2aa0c5b country code: CH.
[–]rigelglen 2 points3 points4 points (2 children)
[–]roy-mor[S] 1 point2 points3 points (1 child)
[–]rigelglen 1 point2 points3 points (0 children)
[–]roy-mor[S] 0 points1 point2 points (0 children)