V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
thundernet8
V2EX  ›  React

纯 ReactJs 搭配 Restful API 做多页面是否可行

  •  
  •   thundernet8 ·
    thundernet8 · 2016-01-15 22:37:46 +08:00 · 3898 次点击
    这是一个创建于 2995 天前的主题,其中的信息可能已经有所发展或是发生改变。

    已经搭建好 API 服务的情况下,写一个 web client ,只用 ReactJs 抓取 API 数据并渲染 html 模板是否可行, ReactJs 是搭配 Jquery ajax 请求数据还是用本身的 fetch 好。这一部分工作应该是纯前端的内容,我想使用 gulp 和 webpack 实现 js /jsx 文件的模块化开发和压缩打包,新建工程时有没有什么推荐的文件夹结构,目前使用 PyCharm 的 IDE

    2 条回复    2016-01-18 09:23:34 +08:00
    dearrrfish
        1
    dearrrfish  
       2016-01-16 06:09:22 +08:00
    用 ajax 就好。
    你需要考虑的是如何保护你的 API key ,我自己常用的做法是用一个简单的 api wrapper proxy 。

    ~/c/R/src   dev ±  lr
    |-config
    |-models
    |-public
    |---images
    |---js
    |-----actions
    |-----classes
    |-----components
    |-----config
    |-----localizations
    |-----stores
    |-----utils
    |---styles
    |-routes (api-proxy, app, index)
    |-sql
    |-views
    Niphor
        2
    Niphor  
       2016-01-18 09:23:34 +08:00
    你需要 reflux/flux/redux
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3013 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 15:03 · PVG 23:03 · LAX 08:03 · JFK 11:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.