Answer the question
In order to leave comments, you need to log in
Why is exposing the api path wrong?
I have an API service. It has the corresponding api path:
http://localhost:8080/VaultDairy/entry/criteria?contentText=...&title=...
http://localhost:8080/VaultDairy/entry/criteria
and get a list of all records without filtering. entryByCriteriaUri = '/api/entry/criteria';
....
getEntriesByCriteria(entry) {
const allEntries = new Array<Entry>();
const headers = new HttpHeaders();
headers.append('accept', '*/*');
headers.append('Authorization', token);
this.http.get<Entry[]>(
this.entryByCriteriaUri,
{
headers: headers,
params: {
'title': entry.title,
'contentText': entry.content.contentText
}
}
).subscribe(entries => {
entries.forEach(entry => {
console.log('Current entries from server: ', entry);
allEntries.push(entry);
});
});
return allEntries;
}
"/api/entry/criteria": {
"target": "http://localhost:8080/VaultDairy/",
"secure": false,
"pathRewrite": {
"^/api/entry/criteria": "entry/criteria"
}
}
this.entryByCriteriaUri
this instead http://localhost:8080/VaultDairy/entry/criteria
. Answer the question
In order to leave comments, you need to log in
Expouser mapping is correct. I just updated the code with the server already running, and such things require a reboot.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question