Package Exports
- @shopify/shopify-app-express
- @shopify/shopify-app-express/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@shopify/shopify-app-express) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@shopify/shopify-app-express
This package makes it easy for Express.js apps to integrate with Shopify.
It builds on the @shopify/shopify-api package and creates a middleware layer that allows the app to communicate with and authenticate requests from Shopify.
Note: this package will enable your app's backend to work with Shopify APIs, and by default it will behave as an embedded app. You'll need to use Shopify App Bridge in your frontend to authenticate requests to the backend.
Getting started
To install this package, you can run this on your terminal:
# You can use your preferred Node package manager
yarn add @shopify/shopify-app-express @shopify/shopify-apiThen, you can import the package in your app
import {shopifyApp} from '@shopify/shopify-app-express';
import express from 'express';
const PORT = 8080;
const shopify = shopifyApp({
api: {
apiKey: 'ApiKeyFromPartnersDashboard',
apiSecretKey: 'ApiSecretKeyFromPartnersDashboard',
scopes: ['your_scopes'],
hostScheme: 'http',
hostName: `localhost:${PORT}`,
},
});
const app = express();
// Handles authenticating your app when you visit /api/auth
app.use('/api', shopify.app());
app.get('/', (req, res) => {
res.send('Hello world!');
});
app.listen(PORT);You can then run your Express app as usual, for instance using:
node ./index.jsAnd access http://localhost:8080 in your browser to view your app.
You can find all allowed configuration options for shopifyApp in the reference docs.