I try to make a POST request to my springboot app hosted on heroku,
const email = 'x@x.com';
const password = 'x';
const data = JSON.stringify({
    email,
    password
});
fetch(
    'https://culinareat-test.herokuapp.com/api/user/users/_login', 
    {
        method: 'POST',
        headers : {
            'Accept' : 'application/json',
            'Content-Type' : 'application/json'
        },
        body : data,
    }
).then(res => {
    console.log(res);
})
This is the controller on my springboot app:
@RestController
@AllArgsConstructor
public class UserController {
    private final UserService userService;
    @RequestMapping(method = RequestMethod.POST, value = "/user/users/_login")
    public LoginResponse logUserIn(@RequestBody LoginRequest loginRequest, HttpServletResponse response, HttpServletRequest request){
        return userService.logUserIn(loginRequest, response, request);
    }
    //another endpoints
}
I tried to do this from another articles i just read on stackoverflow:
@Configuration
public class AppConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**").allowedMethods("*");
    }
}
Still, it does nothing and i still cannot do the request. Any recommendation what should i do? Is there anything i should add on the server-side? Thanks in advance!

 
     
    