Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export Router. #24

Closed
nishp1 opened this issue Apr 15, 2015 · 10 comments
Closed

Export Router. #24

nishp1 opened this issue Apr 15, 2015 · 10 comments
Labels
Milestone

Comments

@nishp1
Copy link

nishp1 commented Apr 15, 2015

I need to disable clientside router which can be done via Router.options.autoStart = false;, but need the Router exposed.

kahmali added a commit that referenced this issue Apr 15, 2015
Fix Issue #24:
- Add a configuration option to disable Iron Router as the client-side
  router
- Add restivus.coffee on the client (in addition to the server) so
  that Restivus can be configured everywhere
- Update API configuration options in README
- Update change log
@kahmali
Copy link
Owner

kahmali commented Apr 15, 2015

I just published an updated version (0.6.4) that adds a new configuration option to resolve this issue. So now you just need to set the useClientRouter option to false when configuring Restivus, like so:

Restivus.configure({
  useClientRouter: false
  // Any other config options you'd like to set
});

And that should take care of it for you. Since this now requires Restivus to configure things on both the client and the server, you have to be sure to call Restivus.configure from the client with this option. You can just configure everything once in a common file (one that is loaded on both the client and server), if that makes things easier.

I've updated the docs to reflect these changes. Let me know if you have any other issues with the latest update. Thanks for putting in this request!

@kahmali kahmali closed this as completed Apr 15, 2015
@nishp1
Copy link
Author

nishp1 commented Apr 15, 2015

Thanks for quick turn around.

Looks like Restivus isn't exposed on the client, getting Uncaught TypeError: Cannot read property 'configure' of undefined error. Is there anything I need to do on my end to make it accessible?

@kahmali
Copy link
Owner

kahmali commented Apr 15, 2015

Hmmm. I tested locally and it worked for me. Let me check it using the published package. In the meantime, I'll reopen the issue. Sorry about that. That's what I get for being too lazy to write an automated test for it.

@kahmali kahmali reopened this Apr 15, 2015
@nishp1
Copy link
Author

nishp1 commented Apr 15, 2015

No worries, happens to the best of us. Meanwhile, adding iron:router as a direct dependency lets me use Router directly.

@kahmali
Copy link
Owner

kahmali commented Apr 15, 2015

This is extremely confusing. When I test locally, it works. If you look in package.js you'll see that restivus.coffee is being added on both the client and server (that's the default when neither is specified). That should allow you to call any methods defined in that file from both the client and the server (Restivus.configure is defined there). When I test locally, if I change it so that restivus.coffee is added only on the server, I get the same error we're getting on the published version, as expected, since the file is explicitly not being made available. So I'm getting two different results from the exact same package depending on whether it's local or published (which shouldn't be the case as far as I know), and I have no way to test a new published version without publishing to everyone. Maybe there's something I can do with semver to make people aware of that or make it so they have to explicitly request a package version in order to install or update to that version. Just thinking out loud in case anyone has any suggestions.

I was hoping to avoid you having to create the direct dependency on iron:router. I know it's not everyone's preferred router, and I intend to move away from it to an independent server-side router that plays nicely alongside others (like arunoda's Picker) as soon as I have the time. iron:router is overkill for this project. Glad you were at least able to find a usable workaround for now. Sorry about the hassle.

@dandv
Copy link
Contributor

dandv commented Apr 20, 2015

I have no way to test a new published version without publishing to everyone

You can create a -dummy copy of the package, publish, test, then run meteor admin set-unmigrated nimble:restivus-dummy, so it won't appear in Atmosphere searches.

@kahmali
Copy link
Owner

kahmali commented Apr 20, 2015

Thanks @dandv! That's just what I needed to test this. That should help me push this along.

@kahmali kahmali added the bug label Apr 20, 2015
@nishp1
Copy link
Author

nishp1 commented Apr 20, 2015

Def. weird...window does have Restivus exposed but as undefined.

@stubailo
Copy link
Contributor

#38 should fix this, I bet!

@kahmali kahmali modified the milestone: v0.7.0 May 2, 2015
@kahmali
Copy link
Owner

kahmali commented May 2, 2015

This is resolved by #46 (which removes Iron Router), and will be included in the next major update, v0.7.0. If you'd like early access, you can clone the latest from the 0.7.0 branch, and use it as a local package. Of course, that branch is a work in progress, so there could be some unexpected behavior. Thanks again for reporting this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants