GraphQL Example project for Toptal blog article: https://www.toptal.com/api-development/graphql-vs-rest-tutorial#utilize-unreal-developers-today
git clone https://github.com/amaurymartiny/graphql-example
cd graphql-example
npm install
npm run devYou should be able to see the app running at http://localhost:3000.
- The
modelsfolder contains the three models: User, Project and Task. They are created using thesequelizeORM. - The
restfolder contains the logic to create the associated/api/users,/api/projectsand/api/tasksendpoints. - The
graphqlfolder contains the schema and resolvers for GraphQL. db.sqlitecontains the database.index.jsstarts the Express server.
This example project is hosted on Heroku.
- The rest endpoints can be viewed here
- http://graphql-example.herokuapp.com/api/users
- http://graphql-example.herokuapp.com/api/projects
- http://graphql-example.herokuapp.com/api/tasks
- The GraphQL endpoint is http://graphql-example.herokuapp.com/graphql, and a GraphiQL interface is mounted here.