sparsetech / trail

Routing library for the Scala platform
82 stars 8 forks source link

Query parameters #16

Closed tindzk closed 7 years ago

tindzk commented 7 years ago

We should support query parameters. Proposal:

val export = Root / "export" / Arg[Long] ? Param[Long]("user") & Param[Option[Int]]("limit")

This will match:

anatoliykmetyuk commented 7 years ago

Two problems with this:

What you propose is useful, but maybe it is not a good idea to hard-code it. Maybe a better approach is to define an extensibility mechanism and build upon the core functionality to introduce this.

tindzk commented 7 years ago

Note that query parameters are not HTTP-specific. You can also specify these parameters with POST requests.

The idea of MetaRouter is to be entirely protocol-agnostic and to support URIs: https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax

So far we only consider paths, but we might also want to support different schemes, hosts etc. in the future.

anatoliykmetyuk commented 7 years ago

Ok, I see. Looks good then.