-
-
Save dvallin/f6d3751bc7725b8dce4cdac00f98c60e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
public class TaskApi { | |
private static final String BASE_REST_PATH = "/api"; | |
private static final String API_PATH = "/tasks"; | |
private static final String APPLICATION_JSON = "application/json; charset=UTF-8"; | |
@Autowired | |
TasksService service; | |
@CrossOrigin(origins = "http://localhost:8080") | |
@RequestMapping( | |
value = BASE_REST_PATH + API_PATH, | |
method = RequestMethod.GET, | |
produces = APPLICATION_JSON | |
) | |
public Flux<Task> list() { | |
return this.service.list(); | |
} | |
@CrossOrigin(origins = "http://localhost:8080") | |
@RequestMapping( | |
value = BASE_REST_PATH + API_PATH + "/add", | |
method = RequestMethod.POST, | |
consumes = APPLICATION_JSON, | |
produces = APPLICATION_JSON | |
) | |
public Mono<Task> add(@RequestBody @Validated final AddTask body) { | |
return this.service.addTask(body); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment