如果用nodejs+express+vue.js开发的
要怎么选择路由?是选择express提供的路由还是vue.js提供的路由
天蓬老师2017-04-17 15:05:36
Although they are both called routing, their starting points are different!
Express routing is normal routing from domain.com/users
, while vuejs routing is from domain.com/#users
# is the root of vuejs and the root of express is / (of course all back-end languages The roots are also /)
express example (get user information):
domain.com/users/1000
vuejs example (get user information)
domain.com/#users/1000
PHPz2017-04-17 15:05:36
What the two don’t want to do is that vue’s routing is front-end routing, which is the routing in single-page applications. The route in express is the path to the file or api interface on the server.
PHP中文网2017-04-17 15:05:36
Vue is a front-end routing, express is a back-end routing, and the idea of vue is to separate the front and back ends. The back end only needs to provide the index.html entry, and other data is obtained through express's routing interface