【发布时间】:2020-08-20 05:44:18
【问题描述】:
我正在尝试使用 web api
API:-
@CrossOrigin(origins="http://IP:4200")
@RestController
@RequestMapping("/api/v1")
public class BasicAuthController {
@PostMapping(path = "/authenticate")
public ResponseEntity<?> createAuthenticationToken(@RequestBody JwtRequest authenticationRequest) {
log.info("end createAuthenticationToken method");
return ResponseEntity.ok(userDetailsinfo);
}
}
客户:-
authenticationService(formData) {
return this.http.post<any>('/api/v1/authenticate', formData).pipe(map((res) => {
debugger;
}));
}
proxy.config.json
{
"/api": {
"target": "http://IP:8080",
"secure": false,
"changeOrigin": true
}
}
我已使用ng-serve 运行客户端应用程序
【问题讨论】:
标签: java angular spring spring-boot