Chapter 3. Building Routes
In this chapter, we will be covering the following topics:
- Defining the services supported by an application
- The flow of requests received
- Configuring routes
- Handling assets
Introduction to Play routes
All the supported routes are specified within a single file: routes
(by default). This makes it all the easier to figure out which one would be ideal.
The routes
file is compiled and if any errors occur, the compilation fails.
However, the routes
file is not a Scala object. So how does the compiler know what to do with the routes
file? To find this out, let's perform the following steps:
- Let's create a project that displays a Hello, World! page. Now, define the
index.scala.html
home page as follows:<!DOCTYPE html> <html> <head> ...
Get Mastering Play Framework for Scala now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.