Add ng serve local proxy configuration for api calls

This commit is contained in:
Clemente Raposo 2020-02-05 10:18:22 +00:00 committed by Dillon-Brown
parent 6cc736f623
commit d4baf71483
4 changed files with 20 additions and 4 deletions

4
.gitignore vendored
View file

@ -11,6 +11,10 @@
/vendor/
###< symfony/framework-bundle ###
###> ng serve ###
/proxy.conf.local.json
###< ng serve ###
build/
config/
!config/.gitkeep

View file

@ -44,6 +44,10 @@ find . -type d -exec chmod 0755 {} \;
find . -type f -exec chmod 0644 {} \;
chmod +x bin/console
```
5. Run `bin/console orm:schema-tool:update --force`
6. Run `npm install`
7. Run `ng build`
5. Go back to root folder
6. Run `bin/console orm:schema-tool:update --force`
7. Run `npm install`
8. Setup proxy config for `ng serve`
- Copy `proxy.conf.env.json` to `proxy.conf.local.json`
- Replace `"target": "http//<api_host>:<api_port>"` with your api url
9. Run `ng build` or `ng serve`

View file

@ -60,7 +60,8 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "SuiteCRM:build:serve"
"browserTarget": "SuiteCRM:build:serve",
"proxyConfig": "./proxy.conf.local.json"
},
"configurations": {
"production": {

7
proxy.conf.env.json Normal file
View file

@ -0,0 +1,7 @@
{
"/api/*": {
"target": "http//<api_host>:<api_port>",
"secure": false,
"changeOrigin": true
}
}