thundernet8
V2EX  ›  React

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

  •  
  •   thundernet8 ·
    thundernet8 · Jan 15, 2016 · 4654 views
  •   You need to sign in to view this topic
    This topic created in 3775 days ago, the information mentioned may be changed or developed.

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

    2 replies    2016-01-18 09:23:34 +08:00
    dearrrfish
        1
    dearrrfish  
       Jan 16, 2016
    用 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  
       Jan 18, 2016
    你需要 reflux/flux/redux
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4799 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 72ms · UTC 09:53 · PVG 17:53 · LAX 02:53 · JFK 05:53
    ♥ Do have faith in what you're doing.