Last active
January 17, 2020 21:10
-
-
Save kelunik/5c5124b9e4fec684665366a17fc2882d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<VueForm action="/api/test.json"> | |
<FormLabel label="First name"> | |
<FormInput name="firstName"/> | |
</FormLabel> | |
<FormLabel label="Last name"> | |
<FormInput name="lastName"> | |
</FormLabel> | |
<FormSubmit>Save</FormSubmit> | |
</VueForm> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"firstName": "...", | |
"lastName": "..." | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pubic class TestAction extends ApiAction<TestAction.Request, TestAction.Response> { | |
public Resolution execute(Request request) { | |
User user = new User(); | |
user.setFirstName(request.firstName); | |
user.setLastName(request.lastName); | |
// save user | |
return respond(new Response(user.getId())); | |
} | |
public static class Request { | |
@Validate(minlength = 3, required = true) | |
public String firstName; | |
@Validate(maxlength = 1024, required = true) | |
public String lastName; | |
} | |
public static class Response { | |
public long id; | |
public Response(long id) { | |
this.id = id; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment