Class WorkerRoute
- Namespace
- Cloudflare.NET.Workers.Models
- Assembly
- Cloudflare.NET.dll
Represents a Worker route that maps URL patterns to Worker scripts.
Routes determine which requests are handled by which Workers based on URL pattern matching.
public record WorkerRoute : IEquatable<WorkerRoute>
- Inheritance
-
WorkerRoute
- Implements
- Inherited Members
Examples
Pattern examples:
example.com/*- All paths on domain*.example.com/api/*- API paths on subdomainsexample.com/static/*- Static asset paths
Constructors
WorkerRoute(string, string, string?)
Represents a Worker route that maps URL patterns to Worker scripts.
Routes determine which requests are handled by which Workers based on URL pattern matching.
public WorkerRoute(string Id, string Pattern, string? Script = null)
Parameters
IdstringUnique route identifier.
PatternstringURL pattern this route matches. Supports wildcards:
*matches any characters.ScriptstringName of the Worker script to execute for matching requests. Can be null to disable Worker for matching routes.
Examples
Pattern examples:
example.com/*- All paths on domain*.example.com/api/*- API paths on subdomainsexample.com/static/*- Static asset paths
Properties
Id
Unique route identifier.
[JsonPropertyName("id")]
public string Id { get; init; }
Property Value
Pattern
URL pattern this route matches. Supports wildcards: * matches any characters.
[JsonPropertyName("pattern")]
public string Pattern { get; init; }
Property Value
Script
Name of the Worker script to execute for matching requests. Can be null to disable Worker for matching routes.
[JsonPropertyName("script")]
public string? Script { get; init; }