$ grails create-app myapp --profile=rest-api
1.2.2 REST API and AngularJS Profiles
Version: 3.2.9
1.2.2 REST API and AngularJS Profiles
REST Profile
A new profile is available designed for the creation of pure REST applications without a UI.
To create a REST application use the rest-api
profile as an argument to create-app:
In earlier milestones this profile was named web-api. The profile has been renamed rest-api which more appropriately describes its purpose.
|
Then start interactive mode to see the available commands for the profile:
$ cd myapp
$ grails
If you hit TAB you will notice code generation commands specific to the profile including:
-
create-domain-resource
- Creates a domain class annotated with the Resource annotation) -
create-restful-controller
- Creates a controller that extends RestfulController.
JSON and Markup Views
The REST profile includes the ability to define JSON and Markup views and the build.gradle
features the ability to compile these views for production use.
The REST profile also creates JSON views to render the index
action and common commands such as generate-views have been overridden to generate JSON views.
AngularJS Profile
An initial version of the AngularJS profile is now available, making it easier to create and integrate AngularJS with Grails 3 applications.
To create a Grails 3 AngularJS application use the angularjs
profile as an argument to create-app:
$ grails create-app myapp --profile=angularjs
Then start interactive mode to see the available commands for the profile:
$ cd myapp
$ grails
You will notice new commands such as create-ng-component
, create-ng-controller
etc. that help you get going creating an AngularJS application.
The build.gradle
is also pre-configured with the necessary Gradle plugins to integrate AngularJS with Asset Pipeline. The created Angular application can be found in grails-app/assets/javascripts
.
For more detail on what the Angular profile provides, see the AngularJS Profile section in the documentation