ustwo / ustwo.com-frontend

The New & Improved ustwo Website
http://www.ustwo.com
Other
1.82k stars 269 forks source link

Can start sandbox, but not local #533

Closed stinoga closed 8 years ago

stinoga commented 8 years ago

I've ran the setup steps (they ran error-free) all they way up to running make -i sync css-watch. This runs fine, but I cannot load the local site. I've tried these urls:

https://local.ustwo.com:3000/ https://localhost:3000/ https://local.ustwo.com:3000/

The sandbox loads fine for me, however, at:

https://local.ustwo.com:9443/sandbox/hero

Could the port be blocked somehow?

Thanks!

ch2ch3 commented 8 years ago

Hi @stinoga, can you try without HTTPS and using your Docker machine IP / localhost? i.e. http://localhost:3000 or http://192.168.99.100:3000

stinoga commented 8 years ago

@ch2ch3 Great, that worked! Just removed the https and went directly to the IP. A couple noob questions on setup:

  1. Where does the default API data come from? Did the initial setup steps setup an accessible wp-api somewhere?
  2. I have a local WP build with the API installed. What configs do I need to change to point my API there locally?

Thanks, love this architecture!

ch2ch3 commented 8 years ago

Hey @stinoga, glad that worked! I'll update the README as the instructions are wrong there :)

  1. We have some static data for the individual components you see inside the sandbox, which can be found in src/app/components/{component}/sandbox.js. Other than this all data comes live from the API.
  2. We're using nginx to proxy /api to our API, so e.g. the frontend might call https://ustwo.com/api/wp-json/ustwo/v1/pages for pages, which gets data from https://wp.ustwo.com/wp-json/ustwo/v1/pages.

    You can change the server locations for backend and staging_backend in etc/nginx/conf.d/default.conf. You might also need to change the Host-API header in etc/nginx/locations/production.conf (likewise for staging.conf).

    If you want to load custom data onto your pages, change src/app/flux/routes.js, which defines what data is to be loaded on each route.