diff --git a/README.md b/README.md index d5b86566a..7ad70b36f 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,12 @@ Use `^C` to stop the node process `npm start` starts. | `API_HOST` | `https://api.scratch.mit.edu` | Hostname for API requests | | `NODE_ENV` | `null` | If not `production`, app acts like development | | `PORT` | `8333` | Port for devserver (http://localhost:XXXX) | +| `FALLBACK` | `false` | Whether or not to fallback to `PROXY_HOST` for non-existent pages/reqeusts | | `PROXY_HOST` | `https://scratch.mit.edu` | Pass-through location for scratchr2 | +#### Current issues with the development +* Login does not work (*In the process of being fixed*) + ### To Test ```bash npm test diff --git a/server/index.js b/server/index.js index 58afac386..589873c1f 100644 --- a/server/index.js +++ b/server/index.js @@ -79,10 +79,13 @@ if (!isProduction) { } })); - // Fall back to scratchr2 in development - // This proxy middleware must come last - var proxyHost = process.env.PROXY_HOST || 'https://scratch.mit.edu'; - app.use('/', proxy(proxyHost)); + var shouldFallback = (process.env.FALLBACK === 'true') || false; + if (shouldFallback) { + // Fall back to scratchr2 in development + // This proxy middleware must come last + var proxyHost = process.env.PROXY_HOST || 'https://scratch.mit.edu'; + app.use('/', proxy(proxyHost)); + } } // Start listening