Go - Api.Route()
Creates a new route (path) within an API.
import ("github.com/nitrictech/go-sdk/nitric")func main() {api := nitric.NewApi("public")route := api.NewRoute("/hello")nitric.Run()}
Parameters
- Name
- match
- Required
- Required
- Type
- string
- Description
- The path matcher to use for this route. Calling - NewRouteon the same API more than once with the same matcher will return the same route object. Matchers accept path parameters in the form of a colon prefixed string. The string provided will be used as that path parameter's name when calling middleware and handlers. See create a route with path params
 
- Name
- options
- Optional
- Optional
- Type
- ...RouteOption
- Description
- Additional options for the route. 
 
Last updated on Feb 4, 2025