Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Hacker News Clone in Universal JavaScript Using React/GraphQL (github.com/clintonwoo)
5 points by clintonwoo on Sept 20, 2017 | hide | past | favorite | 7 comments


Hi, I am the developer of this project. I think the community could use more realistic examples of how to set up a project using GraphQL so I made this. You can use it as a boilerplate to structure your projects. Let me know what you think!


What makes GraphQL a good choice for this problem domain?


You can use GraphQL for basically any Web Service endpoint. It's a way to specify what data you want the endpoint to return without writing custom endpoints for different use cases. Write the schema, define how to retrieve the data then make the queries to the GraphQL Server. It's like a more optimized version of RESTful APIs.


So, how does this not all leak implementation details of your schema to the frontend?

At least with RESTish APIs I can count on a contract and be cheerfully ignorant of any crazy backend changes in how it is being handled.

I'm genuinely curious on this point, since it seems like a big problem.


In a GraphQL schema you can define resolvers which are functions that retrieve/transform the data before returning it. It works quite well so it doesn't matter much what shape the data of your backends are in.


I like it, it's fast, but I tried to create a new account and couldn't, so I guess that doesn't work?


Thanks for the feedback. It's currently mirroring the HN data in memory and not using it's own database. Any writes would be stored temporarily on one server. Also I'd be worried about people inputting credentials on a demo system. Nevertheless it's on the todo list in some form! edit: I'll probably end up making it work client side only for demo




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: