Angular rooting front-end <-> back-end Cant root findByKey() in front end
So, i use postman to test if my findByKey() in back-end works and in fact it works. However, when i try it in front-end services i cant return an object. it returns me an observable everytime i console.log.
Sample 1:
Back-end root
public async findByKey() {
this.app.get("/Path/Contains/:expression", (async (req: Request, res: Response) => {
var pathListDTO = await this.service.findByKey(req);
if (!pathListDTO) {
res.status(400).send("The path was not found!");
} else {
res.json(pathListDTO);
}
}));
}
Sample2:
Front-end root
findByKey(key: string) {
return this.http.get(`${baseUrl}/Contains/?key=${key}`);
}
I dont know if the problem is the contains but in back-end works in postman so idk
here is my baseUrl
const baseUrl = 'http://localhost:9001/path';
Source: Angular Questions