Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type-safe route params #24

Open
amirabiri opened this issue Aug 5, 2015 · 2 comments
Open

Type-safe route params #24

amirabiri opened this issue Aug 5, 2015 · 2 comments

Comments

@amirabiri
Copy link

Feature Request:
I understand that Wasabi is inspired by Sinatra and Express.js, but those are based on dynamic languages. Since this is Kotlin we are talking about, I wonder if any kind of support for type-safe params is planned?

By type-safe params I mean route params, query params, and body. Preferably by binding to an object. For example maybe something along the lines of:

data class ProjectID(val customerId: String, val projectId: String)

data class ProjectData(val name: String, ...)

server.put('/customer/:id/:project', {
    val projectId = request.bindParams<ProjectID>();
    val projectDetails = request.bindBody<ProjectData>();
});

Perhaps it's even possible to use annotations.

I understand this is somewhat SpringMVC-esque and not exactly the Sinatra way, but perhaps some lightweight version is still suitable? It makes sense to provide some type-safety if applying the Sinatra paradigm to a type safe language

(I believe NancyFX may be relevant example)

@hhariri
Copy link
Collaborator

hhariri commented Aug 10, 2015

We're thinking around some things in this direction.

@ghost
Copy link

ghost commented Mar 7, 2016

I'm currently experimenting with combining krouton (https://github.com/npryce/krouton) and Wasabi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants