Install B2C API React example
Edit on GitHubThe B2C API React example can be installed inside Spryker Development Virtual Machine (VM) or on a separate dedicated server. To perform both installation scenarios, take the following steps.
Using a virtual machine ensures a faster deployment as the VM already has all the necessary components installed.
The example application is provided only for display purposes and must under no circumstances be used as a starting point for any project.
Install on a dedicated server
To install the app on a dedicated web server, follow these steps:
-
Make sure that you have Spryker Glue REST API installed and working.
-
Make sure that the following prerequisites are installed on the Node 8.9.3 server or newer.
-
Add the following entries to the
hosts
file of the server:
<Glue_IP> glue.de.project-name.local
127.0.0.1 react.local
where:
<Glue_IP>
—the IP of the Glue REST API server.glue.de.project-name.local
—the local hostname of the Glue REST AP server.react.local
—the local hostname of the B2C API React Example application.
- Clone the B2C API React Example repository:
git clone https://github.com/spryker-shop/b2c-api-react-example
- Open the
local_outside_vm.env
file for editing. - Change the
DEV_SERVER_HOST
variable to point to the example app hostname—for example,react.local
—and theAPI_URL
variable to point to the local hostname of the Glue REST API server. Also, you can change the example app page title. It is specified using theAPP_TITLE
variable. The samplelocal_outside_vm.env
file implementation is as follows:
NODE_ENV=development
DEV_SERVER_HOST=localhost
DEV_SERVER_PORT=3000
WEB_PORT=3000
WEB_PATH="/"
API_URL="`https://glue.mysprykershop.com`"
APP_TITLE=Spryker API React Example
-
Save the changes and close the file.
-
Install
npm cpy
globally:
npm install --global cpy-cli
- Build and run the application:
npm i
npm run dist
npm run serve:local
- Check that the example application is available at the following URL:
http://react.local
- To stop the app, press Ctrl+C. To start it again, run
npm run serve:local
.
Thank you!
For submitting the form