Skip to content

Instantly share code, notes, and snippets.

@scottoffen
Last active June 3, 2017 18:28
Show Gist options
  • Save scottoffen/af9cac93dd1c26440690d9a768ca1117 to your computer and use it in GitHub Desktop.
Save scottoffen/af9cac93dd1c26440690d9a768ca1117 to your computer and use it in GitHub Desktop.
Grapevine: Adding Parameters To Routes

To set up a route that parses parameters from the path info:

[RestRoute(HttpMethod = HttpMethod.GET, PathInfo = "/cars/[carId]")]
public IHttpContext GetCarById(IHttpContext context)
{
	// Get the car id from the incoming context:
	Console.WriteLine(context.Request.PathParameters["carId"]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment