Simplify setup for frontend only development
When only developing the AngularJS frontent, the backend.php can be proxied from the live instance from https://tools.wmflabs.org/croptool/backend.php. This drops the requirement of an OAuth token etc.
A quick solution was setting the following entries in /etc/nginx/sites-enabled/nginx_vhost inside the vagrant instance (208.80.155.131 corresponds to the IP address of tools.wmflabs.org):
location / {
proxy_pass https://208.80.155.131/;
try_files $uri $uri/ =404;
}
location /croptool/ {
root /var/www/html/;
}
location /croptool/files {
proxy_pass https://208.80.155.131/croptool/files;
}
location /croptool/backend.php {
proxy_pass https://208.80.155.131/croptool/backend.php;
}
I'm certain that there are simpler solutions …
Yeah, some info about this would be nice to have in the readme. I can't think of a simpler solution right now.
Another approach would be to send an appropriate Access-Control-Allow-Origin header in backend.php in order to allow the frontend run on http://localhost:8000 (e.g. using php -S localhost:8000) and use https://tools.wmflabs.org/croptool/backend.php for the API calls.