学习webmachine总结

 

 65 学习webmachine总结

 66 webmachine确实“另类”. 没有MVC,没有ORM,还没有像样的tutorials.费了九牛二虎之力在blog中找到相关例子,还是

 67 还好有个有个quickstart http://webmachine.basho.com/quickstart.html

 68 qurkstart里面仅仅讲了编译启动访问。quickstart里面会有dispatch\resource\example\more document的连接,找个自己喜欢的开工好了。

 69 主要构成部分(个人粗浅的理解): 1.dispatch 2.resource 3.request

 70 ----dispatch

 71     关键配置priv/dispatch.conf文件

 72     例如:{["a"], some_resource, []}  a路径 关联了some_resource.erl文件

 73     详见:http://webmachine.basho.com/dispatcher.html

 74 ----resource

 75     这是最基本的erl文件,resurce文件需要导出init/1方法。

 76     必须引入-include_lib("webmachine/include/webmachine.hrl").

 77     还默认提供了好多其他方法,这些方法都是可以重写。

 78     All webmachine resource functions are of the signature:

 79     f(ReqData, Context) -> {Result, ReqData, Context}

 80     注意:to_html,to_text名字都是可以修改,但相应的地方也要修改。 

 81     详细:http://webmachine.basho.com/resources.html

 82 ----request/response

 83     Webmachine request/response data

 84 This is documentation of the Webmachine Request Data API as embodied by the "wrq" module. This module is the means by which resources access and m    anipulate the state of the request they are handling.

 85 Given that all webmachine resource functions have this signature:

 86 f(ReqData, Context) -> {Result, ReqData, Context}

 87 详细参考http://webmachine.basho.com/reqdata.html

 88 .....必须理解 其中的好多方法参数,没有合适的例子只能自己一个个试。难道是因为我对http协议不熟悉造成的.....

 89 

 90 更详细参考http://webmachine.basho.com/docs.html(个人感觉。。。。)                                                                               

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值