Closed neilyoung closed 5 years ago
Route myRoute = ...
get("/", myRoute);
get("/index.html", myRoute)
or
Class myClass {
String myRoute(Request request, Response response) { ... }
}
get("/", myClass::myRoute);
get("/index.html", myClass::myRoute)
I think a possible future feature would be an array or list of strings can be put into the first parameter of "get(...)" Or "post(...)". That would group up multiple routes to the same function.
On Wed, Nov 29, 2017, 12:36 PM David notifications@github.com wrote:
Route myRoute = ... get("/", myRoute); get("/index.html", myRoute)
or
Class myClass { String myRoute(Request request, Response response) { ... } }
get("/", myClass::myRoute); get("/index.html", myClass::myRoute)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/perwendel/spark/issues/947#issuecomment-347954069, or mute the thread https://github.com/notifications/unsubscribe-auth/AGtP5t1P8FHnd-rJb-MFc6Hc7nloCyLZks5s7aQUgaJpZM4QvXXs .
@codemon2002 : This is exactly the solution I would like and had actually in mind.
I see no reason for this functionality. The provided example by @tipsy is a much clearer way of achieving this than pushing and array to the get,post,... functions
Hi, is it possible to have the same target handler being accessed using different routes?
E.g. get("/") should be handled like get("/index.html")