An example using Apollo Client built with React. This project was bootstrapped with Create React App.
You will need the following things properly installed on your computer.
git clone https://github.com/Shopify/storefront-api-examples.git
this repositorycd storefront-api-examples
cd react-apollo
yarn install
If you would like to connect your store to this example, open up src/index.js
and update the domain
and storefrontAccessToken
:
const networkInterface = createNetworkInterface({ uri: 'https://your-shop-name.myshopify.com/api/graphql' });
networkInterface.use([{
applyMiddleware(req, next) {
if (!req.options.headers) {
req.options.headers = {};
}
req.options.headers['X-Shopify-Storefront-Access-Token'] = 'your-storefront-access-token'
next();
}
}]);
Start a local server:
yarn start
- Visit your app at http://localhost:3000.
For help on setting up the repo locally, building, testing, and contributing please see CONTRIBUTING.md.
All developers who wish to contribute through code or issues, take a look at the CODE_OF_CONDUCT.md.
MIT, see LICENSE for details.