Today I Learned

Composing id from 2 URL segments in JSON Server router

Expectation

/properties/6366/statistics/reservations_booked_count should be rewritten to /statistics/6366_reservations_booked_count

Attempt A (fail)

server.use(jsonServer.rewriter({
'/properties/:propertyId/statistics/:statisticId': '/statistics/:propertyId_:statisticId'
}))

It seems that named matches does not work if not separated by at least one / from each other

Attempt B (success)

server.use(jsonServer.rewriter({
    '/properties/:propertyId/statistics/:statisticId': '/statistics/$1_$2'
}))