Play Framework routes not working

I'm just trying to follow along with the ZenTasks tutorial ( http://www.playframework.com/documentation/2.1.0/JavaGuide4 ) for the Play Framework. It seems I can’t even get the login page to work.

I am running this project using the play ~run command. When switching to http://localhost:9000/login error

 Action not found For request 'GET /login' These routes have been tried, in this order: 1 GET/controllers.Application.index() 2 GET/assets/$file<.+>controllers.Assets.at(path:String = "/public", file:String)` 

My routes file looks like

 # Routes # This file defines all application routes (Higher priority routes first) # ~~~~ # Home page GET / controllers.Application.index() # User athentication GET /login controllers.Application.login() POST /login controllers.Application.authenticate() GET /logout controllers.Application.logout() # Map static resources from the /public folder to the /assets URL path GET /assets/*file controllers.Assets.at(path="/public", file) 

and the functions Application.login, authenticate and logout are fully compiled. I missed something incredibly simple because I can’t say what is going wrong?

+6
source share
3 answers

It appears that the routes file has not been compiled properly. you should probably make a clean game in the playback console and try again

 $ play clean-all 
+8
source

@DiAlex

Just in case, play clean-all does not work, you can try

 $ clean 

then

 $ compile 

in the game console.

However, I think both of them do the same.

+4
source

If you use the game interface through Activator, you can simply follow these steps:

  • sbt clean
  • activator launch
+1
source

Source: https://habr.com/ru/post/945649/


All Articles