I created a restful controller with the command grails generate-restful-controller Domain
, how to set scaffold = true
in the controller created, to use the template RestfulController.groovy
You better create REST ready controller, simply by running the command:
$ grails generate-controller [Domain Class Name]
and make it like this
import grails.transaction.*
import static org.springframework.http.HttpStatus.*
import static org.springframework.http.HttpMethod.*
@Transactional(readOnly = true)
class BookController {
…
}
Also you can take help from grails documentation
http://grails.github.io/grails-doc/latest/guide/webServices.html#restfulControllers
hope this helps. Thanks