The dispatch.yaml file

So, we now know how to factor an application into modules and how to access each module. But what if we want certain URL paths to be handled by certain modules instead of relying on the host name / path scheme?

We can do this. The trick is a file called the dispatch.yaml file that contains the URL patterns and the modules that are supposed to handle them. This is what it looks like:

dispatch:    
    - url: "*/api*"
      module: api
    - url: "*/backend*"
      module: backend

This file basically contains two path entries that map to two different modules. The first one is */api*, which means anything containing api in it should be handled by the api module. The second one means that anything starting with backend should be handled by the backend ...

Get Mastering Google App Engine 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.