Logo: Relish

  1. Sign in

Project: Chaplin

Dynamic routes

Routes can be defined with parameters, which can be used in the templates.

Scenarios
Using request parameters from a route
Given
I have the following templates/name.html file
My name is {{params.firstname}}.
And
I have the following app.json file
{
  "routes": {
    "GET /name/:firstname": "name.html"
  }
}
And
I start a Chaplin server
When
I send the request GET /name/Bob
Then
I should get the following response
My name is Bob.

Last published almost 6 years ago by Victor Mours.