graphql-react-app
graphql-react-app copied to clipboard
:bar_chart: A demo app for using GraphQl with React and Spacex API
GraphQL React Application
Description :clipboard:
A demo app for using GraphQl, Appollo Client with React and SpaceX API
GraphQL App DEMO :video_camera:

Details :scroll:
- :arrow_right: We have set up our backend server in node and express app (
localhost:5000/graphql) inserver.js. - :arrow_right: React application is set up using webpack and babel ( that runs webpack-dev-server for the frontend on
localhost:8080) - :arrow_right: The schema and graphQl queries are created in
schema.js - :arrow_right: We have used axios to fetch data using SpaceX API, in the created queries. ( e.g. API URL:
https://api.spacexdata.com/v3/launches) - :arrow_right: GraphiQL playground is available on
localhost:5000/graphql. Check demo. - :arrow_right: We have used Appolo Client to build UI in React that fetches data from GraphQL
- :arrow_right: React components are created and wrapped them inside
<AppoloProvider>and appoloclientis then passed to these components. - :arrow_right: Reach router is used to create routes for home and individual pages.
- :arrow_right: The
graphql-tag( graphQl query parsing utility ) is installed andgplis imported from it. Thegplparses GraphQL query strings into the standard GraphQL AST. - :arrow_right: Use
gplto query the data in front react app, from the schema we have create in our node application in backend. - :arrow_right: We have displayed all the data received as response of the query on home page(
Launches.js). - :arrow_right: When user request for a particular launch item, we query that item by its id and display it on an individual page
Launch.js( e.g. We redirect the user on urlhttp://localhost:8080/launch/1, when he request for launch item with id=1 )
GraphiQL Playground :black_square_button:

GraphiQL Playground DEMO :video_camera:

Installation :wrench:
- Clone this repo by running
git clone https://github.com/imranhsayed/graphql-react-app npm installnpm run server
Useful Links :link:
- Express GraphQL github link
- SpaceX-API
- SpaceX-Docs
- Apollo GraphQL Appollo Client is way to use GraphQL to build client applications. It helps you build a UI that fetches data with GraphQL, and can be used with any JavaScript front-end.
Instructions :point_right:
- Graphiql is a tool that we can use as a client to make request to our server.
- Graph Ql will be avialable at
localhost:5000/graphql
Common Commands :computer:
npm run dev:webpackruns webpack-dev-server for frontend on port 8080 in watch modenpm run serverruns node server for backend onlocalhost:5000/graphqlnpm run devwould run both front end and backend servers on their respective ports, using concurrentlystartRuns the server atlocalhost:5000/graphqlin non watch mode
Built With :zap:
- Node
- Express
- React
- GraphQL
- Appollo Client
- Webpack
- Babel