MVC of the Application

The Beapi API Framework has several built-in tools to help you get started that will automate most of the development/build for you. Below is an explaination of those tools and how to use them.


The Domains

Your Model requires no additional annotations added to it to make the api's function. You merely need to map the database tables like a normal model. Included in the project are several domain classes to show you how one should look. There is nothing complex; just follow GORM principles for creating a basic domain object.


The Controllers

Your controllers requires no additional annotations (or ROLE checks) added to it to make the api's function. Included in the project are several controllers to show you how one should look.

There ARE two caveats to your controller methods however:

  • Every API method in the controller has to be declared as returning 'LinkedHashMap'. For example:
    LinkedHashMap show(){ ... }
  • The return value KEY has to be the class name in camelCase. For example, in the above link provided where the controller class in 'PersonController', we would need the key to be 'person':
    return [person: someValue]

Building The Project

While Grails documentation may tell you how to build your project, thebest (and easiest way) to build and test your project is as follows; go into the ROOT of your project and run the following command:

./gradlew clean;./gradlew build

Troubleshooting