Function routing shares the same syntax as page routing.
Static RoutingBoth top-level and nested routes are supported.
src/api/top-level.js
=> /api/top-level
src/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
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 routesGatsby 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.
Start building today on
Netlify!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4