tuplejump / play-yeoman

Play + Yeoman integration sbt and play plugins
Apache License 2.0
237 stars 58 forks source link

Not able to conect to the scala object, #25

Closed agayakwad closed 10 years ago

agayakwad commented 10 years ago

Hi ,

I am new to this, I am building the app using windows 7 OS, Microsoft Windows [Version 6.1.7601] npm -v ---------- 1.3.11

but will, i want to bring data to bring from the server using scala object with Play 2.2.0 , I am unable to get the data from scala object,

Error : http://localhost:9000/user 404 not found http://localhost:9000/user/1 404 not found

My 'routes~' contains the

GET /user controllers.Users.index() GET /user/:id controllers.Users.edit(id: Long) POST /user/:id controllers.Users.save(id: Long) DELETE /user/:id controllers.Users.remove(id: Long)

If I try to add the above line in 'routes'

[error] .....\conf\routes:18: ReverseUsers is already defined as class ReverseUsers [error] GET /user controllers.Users.index() [error] .....\conf\routes:18: ReverseUsers is already defined as class ReverseUsers [error] GET /user controllers.Users.index() [error]........\conf\routes:18: ReverseUsers is already defined as class ReverseUsers [error] GET /user controllers.Users.index() [error] three errors found error Compilation failed

milliondreams commented 10 years ago

I don't think it has anything to do with play-yeoman. You will find better help porting to play mailing list. Also I'll suggest you put the complete routes file in the mail.

agayakwad commented 10 years ago

Thanks for the replay,

I have published my code on ' https://github.com/agayakwad/yo-demo ' using the existing play-yeoman/yo-demo , please have a look, all i want to do is get the data from scala object using $resource

modified files conf/routes, conf/routes~, ui/app.js, ui/index.html (ie. new .js added)

Added New files in ui/app/scripts, (in Controllers and resources folder) ui/app/views , (in partials and users folder) app/Users.scala , app/modules/User.scala

Url to browse : http://localhost:9000/ui/#/users (where i want to pull the data from scala object) http://localhost:9000/ui/#/user/1 (where i want to pull the data from scala object)

     and http://localhost:9000/ui/#/customers (which is working without scala object ie. only JavaScript)
milliondreams commented 10 years ago

Ok, now I understand. You are trying to add a Restful API in the application.

This API will not be served at /ui/#/customers but directly at /customers

I will recommend using the path /api/customer as it gives a clear distinction. Checkout the updated yo-demo in develop branch.

You can look at this issue too - https://github.com/tuplejump/play-yeoman/issues/26

Hope that clarifies things...

agayakwad commented 10 years ago

Thanks a loot, It is working as we wished. Only thing which we not getting,
we are suppose to refresh the page manually every time i do changes. We need to run this in ruby command promt, if we need to install and work with liveReload, how we can impose client to install LiveReload,

milliondreams commented 10 years ago

You will need to install liveReload plugin for your browser. Or you can include the liveReload script in the index.html manually so it is automatically loaded and works without a plugin.