@RequestMapping(value = "/api/todolist/{index}",
            method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE})
    public ResponseEntity<?> getTodoItem(@PathVariable("index") int index) {
        if (index > todoList.size() - 1) {
            return new ResponseEntity<>(new TodoItem(-1, "index out of range", null), HttpStatus.NOT_FOUND);
        }
        return new ResponseEntity<>(todoList.get(index), HttpStatus.OK);
    }
@RequestMapping(value = "/api/todolist/{index}",
            method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE})
    public ResponseEntity<?> getTodoItem(@PathVariable("index") int index) {
        if (index > todoList.size() - 1) {
            return new ResponseEntity<>(new TodoItem(-1, "index out of range", null), HttpStatus.NOT_FOUND);
        }
        return new ResponseEntity<>(todoList.get(index), HttpStatus.OK);
    }
@ RequestMapping ( value = "/api/todolist/{index}" , method = RequestMethod . GET , produces = { MediaType . APPLICATION_JSON_VALUE } ) public ResponseEntity < ? > getTodoItem ( @ PathVariable ( "index" ) int index ) { if ( index > todoList . size ( ) - 1 ) { return new ResponseEntity <> ( new TodoItem ( - 1 , "index out of range" , null ) , HttpStatus . NOT_FOUND ) ; } return new ResponseEntity <> ( todoList . get ( index ) , HttpStatus . OK ) ; }
HTTP GET
HTTP GET