Skip to content

charlesxor/jdonmvc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

115 Commits
 
 
 
 
 
 

Repository files navigation

why this framework

working on jdon and spring. jdon is a DDD(domain driven design) framework

this framework's target is making web developing easy and simple.

web programing just like FP, the process just is function.

in this framework,you woude thking the controller as the set of function that is cloure when runing.

Now,Write controller

public class Controller {

private static DB db = new DB();

@In
private RequestBody body;

@Path("/")
public Represent index() {
    return new Html("index");
}

@Path("/users")
public Represent get() {
    return Json.create(db.all());
}

@Path("post:/users")
public Represent add(User user) {
    db.add(user);
    return Json.create(new Result(true, "add success"));
}

@Path("put:/users/:id")
public Represent update(int id) throws IOException {
    db.update(body.json2Object(User.class));
    return Json.create(new Result(true, "update successful"));
}

@Path("delete:/users/:id")
public Represent delete(int id) {
    db.del(id);
    return Json.create(db.all());
}

@Path("post:/upload")
public Represent upload(FormFile formFile) {
    return Json.create(new Result(true, "upload successful"));
}

run the demo

About

java web framework working on jdon and spring

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors