这里的路由规则分为了两个部分:请求动态数据或静态资源。 浏览器一般先请求获得 html 页面,然后 html 内容如果有 ajax 则会再发送请求过来,请求动态数据。
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# Routes # This file defines all application routes (Higher priority routes first) # ~~~~
# Home page GET / controllers.ApplicationController.index POST /user controllers.ApplicationController.addUser GET /delete/:id controllers.ApplicationController.deleteUser(id : Long) GET /user/:id controllers.ApplicationController.getUser(id : Long) GET /api/user/:id controllers.ApiController.getUser(id : Long) POST /api/user controllers.ApiController.createUser
# Map static resources from the /public folder to the /assets URL path GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)