Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
It's possible to use Angular 8 http.get to get a page from the frontend itself ? My local frontend url: https://192.168.0.177:4200/ I tried in a service: test(): Observable<string> { ret...
#1: Initial revision
Using http.get to get page from frontend
It's possible to use Angular 8 http.get to get a page from the frontend itself ? My local frontend url: https://192.168.0.177:4200/ I tried in a service: test(): Observable<string> { return this.http .get<string>(`https://192.168.0.177:4200/ping`) .pipe(catchError(this.processHTTPMsgService.handleError)); } but I got a 404: Console: GET https://192.168.0.177:4200/ping 404 (Not Found) ERROR 404 - Not Found <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Error</title> </head> <body> <pre>Cannot GET /ping</pre> </body> </html> This has an hardcoded url because it's just a test. My FE is on port 4200 and my backend in 3443. https://192.168.0.177:4200/ping url load correctly if I put it directly on browser. The /ping url is an Angular component with only a `PING` string inside: ping.component.ts: import { Component } from '@angular/core'; @Component({ selector: 'app-ping', templateUrl: './ping.component.html' }) export class PingComponent { constructor() { } } ping.component.html: PING I call service.test() from some other component this way: test(): void { this.myService.test().subscribe(test=>{ console.log('test', test); // Should result in PING }) } I also tried with axios: axios.get('https://192.168.0.177:4200/ping').then(ping=>{ console.log('ping', ping); }).catch(err=>{ console.log('ping error', err); }); with same result. What I'm trying to do here ? I develop an Angular video application that shows live video stream that take too long. It has a Keycloak login that has an idle limit. So I'm trying to simulate user action in order to make keycloak know it's alive and don't logout automatically. Any help appreciated. Thanks.