Skip to content

Latest commit

 

History

History
37 lines (22 loc) · 1.89 KB

README.md

File metadata and controls

37 lines (22 loc) · 1.89 KB

Frontend development - Gatsby

Prerequisites

  1. Make sure Strapi is running. Follow the steps found in src/cms/

Dev steps to run locally

  1. Navigate to the bcparks.ca/src/gatsby directory.

  2. Copy the .env.example file to .env (cp .env.example .env)

  3. Edit the .env file in a text editor and choose which datasource you want to use

  • Localhost: REACT_APP_CMS_BASE_URL=http://localhost:1337
  • Dev: REACT_APP_CMS_BASE_URL=https://dev-cms.bcparks.ca (needs VPN)
  • Test: REACT_APP_CMS_BASE_URL=https://test-cms.bcparks.ca (needs VPN)
  • Prod: REACT_APP_CMS_BASE_URL=https://cms.bcparks.ca
  • Alpha Dev: REACT_APP_CMS_BASE_URL=https://alpha-dev-cms.bcparks.ca (needs VPN)
  • Alpha Test: REACT_APP_CMS_BASE_URL=https://alpha-test-cms.bcparks.ca (needs VPN)
  1. Generate a full-access Strapi API token on the selected environment and set the STRAPI_TOKEN varibale in your .env file.

  2. Back in your shell, from /src/gatsby folder run: npm install

  3. Start Gatsby in develop mode by running: npm run start. It may take a few minutes to load the required data. When it completes, you should be able to view the site at http://localhost:8000.

  4. If you are running gatsby in a VM, you can pin the websocket port in order to allow a forwarding rule to work consistently. export INTERNAL_STATUS_PORT=<port number> See this issue for more info.

Previewing Changes using Gatsby GraphQL

  1. With Gatsby running in develop mode, make changes in the Strapi CMS.

  2. Visit http://localhost:8000/___graphql and click "Refresh Data" (top right).

  3. You should be able to view the updated content at http://localhost:8000