kahmali/meteor-restivus

Deployed app shows iron:router welcome screen, local app works fine

dandv opened this issue · 10 comments

dandv commented

Reproduction repo: https://github.com/dandv/webix-restivus
Demo: http://webix-restivus.meteor.com/

The bug summary is the naive observation. Looking at the console shows a Reference error "Route is not defined" at nimble-restivus.js line 124:

route = new Route(this, path, options, methods);

When deployed with --debug, the deployed app also continues to run, and shows the grid, just as the locally run app does. BTW, should --debug cause this difference? CC @stubailo.

This is ultimately caused by Restivus.addCollection being called on the client via lib.

Should be fixed by #41

Absolutely, @stubailo. I'm reviewing #41 now and it looks good so far (I'll post all this and more on the actual pull request later today). I just have an exam I need to cram for until Wednesday, so I may not be able to finish reviewing it until then. Sorry for the hold up on this! I look forward to getting rid of all these iron:router issues once and for all.

No problem, @kahmali! Take as much time as you need.

This is resolved by #46. Thanks so much for reporting it!

Im receiving the same error on the file nimble_restivus.js:124 Uncaught ReferenceError: Route is not defined

@renewsoqv There's no reason to configure or define routes on the client. Just do everything on the server and you should be fine. I'll be sure to only export Restivus on the server and make that very clear in the next update.

If you're not using Iron Router on the client, then you'll have to wait until v0.7.0 is published (or clone an early build from the 0.7.0 branch).

@kahmali My config is as:

Restivus.configure
  useAuth: true
  prettyJson: true
  useClientRouter: false
  onLoggedIn: -> console.log "#{@user.email} (#{@userId}) logged in on api"
  onLoggedOut: -> console.log "#{@user.email} (#{@userId}) logged out on api"

On the common folder, i used it there following the instructions on docs. Should i move it to a server folder?

@renewsoqv See #65 (specifically, this response). The short answer is yes. Config should happen on server.

@kahmali Thanks, placing the config on the server folder solved my issue, plus the reading of #65 really clarify everything.

Sorry for leaving the docs out of sync once that bug was discovered! I should have removed that information. I've created a new issue and I'll fix it in the next update (0.6.6).