Company
Date Published
Author
Sashko Stubailo
Word count
2269
Language
English
Hacker News points
None

Summary

The author discusses implementing a GraphQL API in Discourse, an open-source forum application built using Ruby on Rails. The author highlights three main issues with REST APIs that GraphQL addresses: data coupled to UI needs, many endpoints for similar data, and lack of external API documentation. By modeling the data in a more semantic and structured way, GraphQL can provide a more efficient and scalable solution for querying data. The author also discusses implementing authentication against a Rails app using a login token, which is stored in a cookie and sent with each request to prove identity. This allows users to log in and access restricted endpoints from any place they can make a GraphQL query. Overall, the author concludes that GraphQL makes APIs easier to understand and query, and is excited to build more on this API example and implement a Discourse mobile app on top of it.