wardbell / a2-in-memory-web-api

An in-memory web api for demos and tests
MIT License
47 stars 11 forks source link

complex resource paths #2

Open johnpapa opened 8 years ago

johnpapa commented 8 years ago

support for

 `/api/customer/32/orders`
 `/api/customer/32/orders/451`
 `/api/customer/address`
wardbell commented 8 years ago

We take PRs ;-)

I agree it would be nice. Do you have the use case now?

wardbell commented 8 years ago

I'd like the solution to be support almost any request url scheme.

My instinct is to add a configurable route/response map where the response is a function with access to the in-mem datastore, original request, parsed request, and response-building helper functions.

We'll need a route recognizer for request url pattern matching and parsing of parameters.

The current route handling would become the initial, default state of this map.