Skip to content

Commit 6bee798

Browse files
committed
add CORS proxy
1 parent 067ec2f commit 6bee798

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

angular.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
},
5252
"serve": {
5353
"builder": "@angular-devkit/build-angular:dev-server",
54+
"options": {
55+
"buildTarget": "Project-1:build",
56+
"proxyConfig": "proxy.conf.json"
57+
},
5458
"configurations": {
5559
"production": {
5660
"buildTarget": "Project-1:build:production"

proxy.conf.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"/vds/*": {
3+
"target": "https://smstestbed.nist.gov/",
4+
"changeOrigin": true
5+
}
6+
}

src/app/current-data-tab/current-data-tab.component.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,18 @@ export class CurrentDataTabComponent implements OnInit {
2323
}
2424

2525
loadXmlDocument(): void {
26-
this.http
27-
.get('assets/test-data/current.xml', { responseType: 'text' })
28-
.subscribe({
29-
next: xmlContent => {
30-
// Convert XML string to XMLDocument
31-
const parser = new DOMParser();
32-
this.myXmlDocument = parser.parseFromString(
33-
xmlContent,
34-
'application/xml'
35-
);
36-
},
37-
error: err => {
38-
console.error('Error fetching XML file:', err);
39-
},
40-
});
26+
this.http.get('vds/current', { responseType: 'text' }).subscribe({
27+
next: xmlContent => {
28+
// Convert XML string to XMLDocument
29+
const parser = new DOMParser();
30+
this.myXmlDocument = parser.parseFromString(
31+
xmlContent,
32+
'application/xml'
33+
);
34+
},
35+
error: err => {
36+
console.error('Error fetching XML file:', err);
37+
},
38+
});
4139
}
4240
}

0 commit comments

Comments
 (0)