V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
mhtt
V2EX  ›  iDev

服务器端 API,大家都是怎么架构的呢?

  •  
  •   mhtt · 2014-07-25 00:29:40 +08:00 · 11379 次点击
    这是一个创建于 3561 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我们接客户的app单子,也会做自己的app,在服务器端我们用了可能是大家眼里最初级,但容易上手的php+mysql,restful框架基于github上的一个开源框架CodeIgniter Rest Server(https://github.com/chriskacerguis/codeigniter-restserver),做了自己的改造。 你们的是个什么样的情况呢?
    ps. 听说node.js在对app强劲的支持表现很久了,有推荐的restful框架吗?
    第 1 条附言  ·  2014-07-25 09:41:56 +08:00
    大家别光收藏,也来分享分享你的
    29 条回复    2014-07-25 18:38:15 +08:00
    zyx89513
        1
    zyx89513  
       2014-07-25 00:42:54 +08:00   ❤️ 1
    php slim framework 可以试试, 轻量级, benchmark测试效率挺高的.这里有个guide:

    http://www.androidhive.info/2014/01/how-to-create-rest-api-for-android-app-using-php-slim-and-mysql-day-12-2/

    这个是用Go写的 https://github.com/ant0ine/go-json-rest
    spark
        2
    spark  
       2014-07-25 08:45:15 +08:00 via iPhone
    Sails
    pobing
        3
    pobing  
       2014-07-25 09:41:18 +08:00
    mhtt
        4
    mhtt  
    OP
       2014-07-25 09:41:29 +08:00
    @zyx89513 感谢已发
    dopcn
        5
    dopcn  
       2014-07-25 09:44:40 +08:00
    rails 可以用来做 API 吗
    CoX
        6
    CoX  
       2014-07-25 09:45:20 +08:00
    Slim 做 Rest API 很不错
    jjzxcc
        7
    jjzxcc  
       2014-07-25 09:46:06 +08:00
    @dopcn 可以啊,我正在用rails + grape。
    justfindu
        8
    justfindu  
       2014-07-25 09:49:39 +08:00
    我之前也用楼主同样的方式做接口, 不过最终没有推出. 想问下压力如何.
    wecoders
        9
    wecoders  
       2014-07-25 09:49:39 +08:00
    用你熟悉的方案,php,python,ruby,go,java都可以
    我直接python+tornado
    simonyan
        10
    simonyan  
       2014-07-25 09:53:26 +08:00
    node + express,搭建的很快。
    yakczh
        11
    yakczh  
       2014-07-25 09:56:05 +08:00
    wangfeng3769
        12
    wangfeng3769  
       2014-07-25 09:56:26 +08:00
    @wecoders
    赞同不过python flask 更轻量级
    yueyoum
        13
    yueyoum  
       2014-07-25 09:59:13 +08:00
    我一直没明白, REST API 一定要用 REST 框架来做吗?

    有个自己熟悉的 web 框架, 定义好 URL, 各种 HTTP METHOD 的相应,
    不就完成了这项工作吗?
    humiaozuzu
        14
    humiaozuzu  
       2014-07-25 10:00:46 +08:00
    公司用的是 Flask,自己写几个 helper function 就 REST 了。
    rming
        15
    rming  
       2014-07-25 10:00:48 +08:00
    根据需求选工具啊,如果单纯做api自己用,那你说的那个框架里的Format class岂不是没什么用
    TangMonk
        16
    TangMonk  
       2014-07-25 10:04:05 +08:00
    @yueyoum 麻烦啊,
    mahone3297
        17
    mahone3297  
       2014-07-25 10:12:59 +08:00
    @TangMonk 这么说restful框架帮忙做了很多事?
    TangMonk
        18
    TangMonk  
       2014-07-25 10:15:48 +08:00
    @mahone3297 是啊,你自己用纯PHP 和用 slim 框架对比下就知道了呗,能省很多事
    TangMonk
        19
    TangMonk  
       2014-07-25 10:16:36 +08:00
    @mahone3297 况且这种轻量框架又是一眼就看懂的,又不难学
    sxd
        20
    sxd  
       2014-07-25 10:27:06 +08:00
    format
        21
    format  
       2014-07-25 10:27:29 +08:00
    http://www.ruanyifeng.com/blog/2014/05/restful_api.html
    ruanyifeng老师有篇文章讲RESTFUL API设计的,可以参考。
    robertlyc
        22
    robertlyc  
       2014-07-25 11:01:26 +08:00
    ruby的grape
    liunan1321
        23
    liunan1321  
       2014-07-25 11:03:56 +08:00
    beego
    mahone3297
        24
    mahone3297  
       2014-07-25 11:18:23 +08:00
    @TangMonk 那我如果用大型框架呢?比如zend,symfony,laravel这种?跟什么resuful框架比有什么区别?
    TangMonk
        25
    TangMonk  
       2014-07-25 11:50:35 +08:00
    @mahone3297 restful 框架要轻量些,拿到就可以用,MVC里就只有 C 层
    TangMonk
        26
    TangMonk  
       2014-07-25 11:52:16 +08:00
    @mahone3297 我没用过 slim,不过粗略看了下官网,应该和我想的一样。
    awebird
        27
    awebird  
       2014-07-25 11:52:49 +08:00
    也是用的codeigniter-restserver,还算方便,我觉得oauth, cahce和DB的优化这些经典问题比用什么框架还重要些
    mhtt
        28
    mhtt  
    OP
       2014-07-25 13:30:35 +08:00
    @justfindu 目前没有遇到压力问题。
    @awebird thanks
    garth
        29
    garth  
       2014-07-25 18:38:15 +08:00
    最简单的API Server: https://github.com/easychen/LazyREST
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2688 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 15:54 · PVG 23:54 · LAX 08:54 · JFK 11:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.