Dear all,
(1) I had been working with Grails many years back. Looking for a good backend framework now (frontend will use angular.js). My first question is whether Grails is still a good choice to provide pure REST services?
(2) I tried to follow the documentation (section 9.1.5.1). I have created a domain class called "Restaurant" having two attributes (title, website). Then I have created a RestaurantController having following code:
import grails.rest.RestfulController
import grails.transaction.*
@Transactional(readOnly = false)
class RestaurantController extends RestfulController {
static responseFormats = ['xml', 'json']
RestaurantController() {
super(Restaurant)
}
}
I have sent a POST request to the URI "
http://localhost:8080/restaurant" with following content "title=Asia+Imbiss&website=
www.asia-imbiss.com". But no matter which URL I use I get a
java.lang.NullPointerException exception caused by
Cannot invoke method count() on null object (see screenshot). What am I doing wrong here?
Btw: If I don't create a controller and use the @Resource(uri='/restaurant')like stated in 9.1.1, it works fine!