The code samples used in this book are available on GitHub—they are grouped by chapters. If a chapter has code samples, look for the directory with the respective name.
Technically, you don’t have to use any integrated development environment (IDE) to run code examples (except the CDB example from [productivity_tools]). Just open the main file in a web browser, and off you go. But using an IDE will make you more productive.
The authors of this book like and recommend using the WebStorm IDE from JetBrains. In addition to smart context-sensitive help, autocomplete, and syntax highlighting, WebStorm offers HTML5 templates, and a code coverage feature that identifies code fragments that haven’t been tested.
The WebStorm IDE is pretty intuitive to use. If you’ve never used it before, refer to its Quick Start Guide. When you first start WebStorm, on the Welcome screen, select the option Open Directory. Then, select the directory where you downloaded the samples of a specific book chapter. For example, after opening code samples from [mocking_up_the_app], the WebStorm IDE might look as shown in Code samples from Chapter 1 displayed in WebStorm.
<!DOCTYPE html> <html> <head> <title></title> </head> <body> </body> </html>
WebStorm comes with a simple internal web server. Right-click the HTML file that you want to open (for example, index.html) and choose Open in Browser. WebStorm’s internal server will serve the file to the browser.
For example, if WebStorm opens the directory chapter1, as in Code samples from Chapter 1 displayed in WebStorm, you’ll see the following URL in your web browser: http://localhost:63342/chapter1/project-01-get-started.
To open the content of the Eclipse WebContent directory in WebStorm, choose File→Open Directory and point it at the WebContent directory of your Eclipse project.
Mac users can also do it another way:
Create a script to launch WebStorm from the command line. To do this, start WebStorm and choose Tools→Create Launcher Script. Agree with defaults offered by the pop-up window shown in Creating the launch script for WebStorm or select another directory located in the PATH system variable of your computer. This creates a script named wstorm, and you’ll be able to start WebStorm from a command line.Figure 2. Creating the launch script for WebStorm
Such a complex setup looks like overkill, but we are talking about enterprise development, for which you might have to jump through some hoops to create a convenient working environment for yourself. Besides, you do it only once.