From e15b16a65f7c0bd3e05be5d7d482fe3a5398a9c8 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Sat, 17 Oct 2020 14:27:54 +0200 Subject: [PATCH] fix development server proxy --- pdb-js/proxy.conf.json | 14 +++++++++++++- pdb-js/src/app/plot.service.ts | 8 ++++---- .../main/java/org/lucares/pdbui/PdbController.java | 1 + 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/pdb-js/proxy.conf.json b/pdb-js/proxy.conf.json index 1ca7695..2f2219b 100644 --- a/pdb-js/proxy.conf.json +++ b/pdb-js/proxy.conf.json @@ -1,9 +1,21 @@ { - "/": { + "/assets": { "target": "http://localhost:17333", "secure": false, "pathRewrite": {"^/foobar" : ""}, "changeOrigin": true, "logLevel": "debug" + }, + "/api": { + "target": "http://localhost:17333", + "secure": false, + "changeOrigin": true, + "logLevel": "debug" + }, + "/img-generated": { + "target": "http://localhost:17333", + "secure": false, + "changeOrigin": true, + "logLevel": "debug" } } \ No newline at end of file diff --git a/pdb-js/src/app/plot.service.ts b/pdb-js/src/app/plot.service.ts index a11ea16..6eca1de 100644 --- a/pdb-js/src/app/plot.service.ts +++ b/pdb-js/src/app/plot.service.ts @@ -40,7 +40,7 @@ export class PlotService { } getTagFields(): Observable> { - return this.http.get>('//'+window.location.hostname+':'+window.location.port+'/fields'); + return this.http.get>('//'+window.location.hostname+':'+window.location.port+'/api/fields'); } autocomplete(query: string, caretIndex: number, resultMode: ResultMode): Observable @@ -51,17 +51,17 @@ export class PlotService { .set('query', query) .set('resultMode', resultMode) }; - return this.http.get('//'+window.location.hostname+':'+window.location.port+'/autocomplete', options); + return this.http.get('//'+window.location.hostname+':'+window.location.port+'/api/autocomplete', options); } sendPlotRequest(plotRequest: PlotRequest): Observable{ //console.log("send plot request: "+ JSON.stringify(plotRequest)); - return this.http.post('//'+window.location.hostname+':'+window.location.port+'/plots', plotRequest); + return this.http.post('//'+window.location.hostname+':'+window.location.port+'/api/plots', plotRequest); } getFilterDefaults(): Observable{ - return this.http.get('//'+window.location.hostname+':'+window.location.port+'/filters/defaults') + return this.http.get('//'+window.location.hostname+':'+window.location.port+'/api/filters/defaults') } splitQuery(query: string, splitBy:string) : Observable>{ diff --git a/pdb-ui/src/main/java/org/lucares/pdbui/PdbController.java b/pdb-ui/src/main/java/org/lucares/pdbui/PdbController.java index f30d468..c7903ce 100644 --- a/pdb-ui/src/main/java/org/lucares/pdbui/PdbController.java +++ b/pdb-ui/src/main/java/org/lucares/pdbui/PdbController.java @@ -60,6 +60,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Controller @EnableAutoConfiguration +@RequestMapping(path = "/api") @CrossOrigin(origins = { "http://localhost:4200", "http://127.0.0.1:4200" }) public class PdbController implements HardcodedValues, PropertyKeys {