Routing
Function routing shares the same syntax as page routing.
Static Routing
Both top-level and nested routes are supported.
src/api/top-level.js=>/api/top-levelsrc/api/directory/foo.js=>/api/directory/foo
index.js files are routed at their directory path e.g. src/api/users/index.js => /api/users
Dynamic Routing
Param routes
Use square brackets ([ ]) in the file path to mark dynamic segments of the URL.
So to create an Function for fetching user information by userId:
Dynamic routes share syntax with client-only routes.
Splat routes
Gatsby also supports splat (or wildcard) routes, which are routes that will match anything after the splat. These are less common, but still have use cases.