CHAPTER 7: Rapid Web Development with Grails 305
Bookstore Application
In this chapter, you will be learning to leverage the Grails conventions and scaffolding to create
a simple but functional version of the bookstore application. This initial version of the application
will not be production-ready, however; the objective of this application is to show you how, with
scaffolding, you can render a CRUD web application with almost no code other than your domain
class code. In addition, Grails will generate a database schema and populate a database with the
schema when the application is run.
Creating the Bookstore Application
To create the bookstore application, you need to execute the create-app target using an optional
project name on the command line, as shown here:
grails create-app bookstore
The entire line in the preceding command line is a command, where create-app is a target. A target
is a specific task that you want Grails to execute.
Note Using the help command yields a list of available targets: >grails help.
If you don’t supply the project name when using create-app, you will be prompted for one.
After the create-app target has run, you have a new directory matching the name of your project.
This is the root of your new project, and you must make all subsequent Grails command-line calls
from within this directory. It’s a good idea to use the cd command to get into the directory now so
you don’t forget. Within the new project directory, you will find a structure matching the directory
structure shown in Figure 7-4.