Updated readme to note how to run the app against production (#706)

* Noted upper limit of Node.js verion support for the application: the SCSS dependency v4.13.1 only supports Node.js up to v13.9.0.
Added note for npm commands for running the application against local APIs versus production. The correct npm command for running against production was found here https://github.com/bitwarden/web/issues/666.
Added more lines to the services.module.ts example to better reflect the actual file.

* Added CORS common issue and solution to README.md

* Changed Node.js version notes for real this time.
This commit is contained in:
Joshua McCauley 2020-12-10 09:08:31 -08:00 committed by GitHub
parent f84ee30b9d
commit 04811c934f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 0 deletions

View File

@ -27,6 +27,8 @@
### Run the app ### Run the app
For local development, run the app with:
``` ```
npm install npm install
npm run build:watch npm run build:watch
@ -39,6 +41,7 @@ await apiService.setUrls({
base: isDev ? null : window.location.origin, base: isDev ? null : window.location.origin,
api: isDev ? 'http://mylocalapi' : null, api: isDev ? 'http://mylocalapi' : null,
identity: isDev ? 'http://mylocalidentity' : null, identity: isDev ? 'http://mylocalidentity' : null,
events: isDev ? 'http://mylocalevents' : null,
}); });
``` ```
@ -49,9 +52,31 @@ await apiService.setUrls({
base: null, base: null,
api: 'https://api.bitwarden.com', api: 'https://api.bitwarden.com',
identity: 'https://identity.bitwarden.com', identity: 'https://identity.bitwarden.com',
events: 'https://events.bitwarden.com',
}); });
``` ```
And note to run the app with:
```
npm install
npm run build:prod:watch
```
## Common Issues:
### CORS
If you run the frontend and receive a notification after attempting to login that says:
```
An error has occurred.
NetworkError when attempting to fetch resource.
```
And in the console:
```
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.bitwarden.com/accounts/prelogin. (Reason: CORS header Access-Control-Allow-Origin missing).
```
This means that you are having a CORS header issue. This can be mitigated by using a CORS header changing extension in your browser such as [this one.](https://mybrowseraddon.com/access-control-allow-origin.html)
## Contribute ## Contribute