My client-side application(Front end) - Angular My server-side application(Back end) - Java JAX-RS (jersy)
I'm getting this error when I call a function from frontend to backend
My angular service code
import { User } from './../model/user';
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
const headeroption = {
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
};
@Injectable({
providedIn: 'root'
})
export class UserService {
constructor(private http: HttpClient) { }
url = 'http://localhost:9090/HealthCare2/services/';
user: Observable<User[]>;
//Testing
test() {
return this.http.get(this.url + 'user/test');
}
My Java JAX-RS Controller
@Path("/user")
public class UserController {
UserService userService = new UserService();
// Test function
@GET
@Path("/test")
@Produces(MediaType.TEXT_HTML)
public String testing() {
return "Test Function is working";
}
}