I'm having trouble finding the right path to use in the $http requests in order to access the @RestController in my Spring Boot App. I'll include the relevant code below, hoping that you'll see something i'm not. I apologize that code is not fully in english, but i think it will be easy to understand.
Here's the backend rest controller that i'm suppoused to target:
@RestController @RequestMapping("/fileData") public class FileDataService { @Autowired HttpServletRequest request; @Autowired ServletContext ctx; @RequestMapping(method = RequestMethod.GET, value = "fileData/getKorisnici", produces = MediaType.APPLICATION_JSON_VALUE) //@ResponseBody public Collection<Korisnik> getKorisnici() { return getFileData().getKorisnikValues(); } /*@POST @Path("/addKorisnik") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)*/ @SuppressWarnings("rawtypes") @RequestMapping(method = RequestMethod.POST, value = "/addKorisnik", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) //@ResponseBody public ResponseEntity addKorisnik(Korisnik k) { if(getFileData().usernameExistsKorisnici(k.getKorisnickoIme())) { return ResponseEntity.status(HttpStatus.CONFLICT).build(); } else if(getFileData().emailExistsKorisnici(k.getEmail())) { return ResponseEntity.status(HttpStatus.CONFLICT).build(); } getFileData().getKorisnici().put(k.getIdKorisnik(), k); getFileData().writeData(); return ResponseEntity.ok().build(); } And here's the frontend side:
app.factory('korisnikFactory', function($http) { var factory = {}; factory.getKorisnici = function() { //return $http.get('/drools-spring-v02-app/rest/fileData/getKorisnici'); return $http.get('/fileData/getKorisnici'); }; factory.addKorisnik = function(korisnik) { return $http.post('/fileData/addKorisnik', korisnik); }; return factory; });