dantegg
V2EX  ›  Node.js

多个包含 react,react-router 的单页,express 如何将它们重定向?

  •  
  •   dantegg · Feb 17, 2017 · 3874 views
    This topic created in 3381 days ago, the information mentioned may be changed or developed.
    比方说:index.html 下有一个 react-router 路径为'/user'
    而 sys.html 中有一个 react router 路径为'/sys'

    请问 express 如何从 index.html 重定向到 sys.html?
    6 replies    2017-02-17 21:20:39 +08:00
    cheetah
        1
    cheetah  
       Feb 17, 2017
    没懂,你 express 里从 /usr 重定向到 /sys ,然后浏览器加载后,不就由前端接管了吗
    dantegg
        2
    dantegg  
    OP
       Feb 17, 2017
    @cheetah 两个单页里都有前端路由的话好像就不行了
    tanxiaoqing
        3
    tanxiaoqing  
       Feb 17, 2017
    所有路由让前端来接管。
    dantegg
        4
    dantegg  
    OP
       Feb 17, 2017
    @tanxiaoqing 看来只能这样了
    dantegg
        5
    dantegg  
    OP
       Feb 17, 2017
    @tanxiaoqing 如果其他页面都不说 react 单页那也要让前端接管吗?
    Nitromethane
        6
    Nitromethane  
       Feb 17, 2017
    https://www.v2ex.com/user#/index
    https://www.v2ex.com/sys#/index
    #前边的由后端路由,#后边的由后端路由
    problem solved~
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2743 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 12:47 · PVG 20:47 · LAX 05:47 · JFK 08:47
    ♥ Do have faith in what you're doing.