Solon v3.0.2

Solon RESTFul Api 开发

</> markdown

这个分类的内容较少,示例一下就没了。。。如果有别的需要,反馈给我。我补充:)

参考示例:

@Mapping("books")
@Controller
public class Demo{
    
    //查看一本图书:GET http://demo.com/books?id=1
    @Get
    @Mapping
    public String one(Long id){
        return "one";
    }
    
    //新增一本书:POST http://demo.com/books
    //Data: name=shuxue
    @Post
    @Mapping
    public String add(Book book){
        return "add";
    }
    
    //修改一本书:PUT http://demo.com/books 
    //Data:id=1,name=shuxue
    @Put
    @Mapping
    public String update(@NotNull Long id, String name){
        return "update";
    }
    
    //查看一本图书:删除一本书:DELETE http://demo.com/books
    //Data:id=1
    @Delete
    @Mapping
    public String del(@NotNull Long id){
        return "del";
    }
}