Serve another(standalone) page or static file in website built with react

前端 未结 6 1616
陌清茗
陌清茗 2021-02-02 09:53

I have a website built with react, which uses react-router. For some route I want to serve another page or static file, but since all request are forwarded to react router, its

6条回答
  •  野的像风
    2021-02-02 10:09

    If the pages are unrelated to the Reactjs App at all(i.e. using another directory), I think we can route it from Node layer using the following code, so that the structure is more intuitive:

    app.use('/url_to_static_pages', express.static('path_to_static_files'));
    

提交回复
热议问题