question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Possibility to use choo without routing/router

See original GitHub issue

Expected behavior

When working in a hybrid, microservice routing environment, I should just mount the specific route (e.g. after code split) without using the any (or pushstate) router. Express is now a source of truth for router.

Actual behavior

When working in a hybrid, microservice routing environment, I need to double up for express router instead letting express hit the route with name-of-route.js script. Express isn’t now a source of truth for router.

I could not find answer to that in any documentation bit so far, hence the question. Is it possible? It is because we have a higher level routing solution routing the site to many different places, places using different technologies that only share the theme, and are microservices essentially.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
graforlockcommented, Sep 24, 2017

@bcomnes @jonjaques If anyone’s interested, a wrapper to allow just that:

https://github.com/graforlock/choo-detached

2reactions
jonjaquescommented, Sep 6, 2017

Can’t you just do something like this?

const app = Choo({history: false})
module.exports = app

app.route(window.location.href, mainView)
if (global.document) {
  app.mount(...)
}

function mainView(state, emit) {
  switch(state.cond) {
    case 'a': return html``
    case ...
  }
}

That way it won’t listen for or try to pushState on links, just a full page reload. If you want to switch views, just do so via state. If it’s 4kb minified, seems like the 1-2 kb you would save by decoupling the router isn’t the most pressing concern.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Routing - Choo
To perform routing, Choo uses a Trie data structure. This means that our routing is fast, and the order in which routes are...
Read more >
React Router v6 - nested routing without Outlet - Stack Overflow
Is it possible to use nested routes without using the Outlet component? No, an Outlet component is required in order to render the...
Read more >
Common Routing Tasks - Angular
To use the Angular router, an application needs to have at least two components ... every URL and the Router selects it only...
Read more >
choojs/choo: - sturdy 4kb frontend framework - GitHub
Unless hash routing is enabled, if a hash is found we check if there's an anchor on the same page, and will scroll...
Read more >
Communication between networks without routing - is it ...
The only thing I can think of is that router knows all networks that are connected to it so within it there is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found