Hello together,
currently I’m trying to mock the api in aurelia-cli. My structure currently looks as follows:
Calling localhost:9000/api/v1/users/ should response a user index json.
I added the following folder Structure to my project:
- api
- v1
- users
- users.json
- users
- v1
My User Index Class:
this.HttpClient.fetch("http://localhost:9000/api/v1/users/", {
headers: {"Content-Type": "application/json", 'Accept': 'application/json'},
method: "GET"
})
.then(response => {
return response.json()})
.then(data => {
console.log(data);
}).catch(err=>{
console.log("Error on requesting User Index");
throw "Something went wrong on requesting the API for getting users, " + err;
});
The problem now is, that calling the mentioned route, I get an error… only calling localhost:9000/api/v1/users /users.json works, but this is not what I need to have.
Does anyone has an idea how I can solve that?
Best regards,