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.

Consider extract the routing code from core

See original GitHub issue

Hi @jbucaran,

I felt in love with hyperapp because is almost the perfect essence of the Elm application architecture. All the code is clean, simple and functional 👍 The only part that looks a little bit hacky is the routing code. But there are other reasons to extract it:

  • Not all applications need routing. That would help to reduce the size of the core.
  • Even if they use routing, is not always to change the view.

I don’t know the best solution (that’s why I’m opening this issue), but I think the API could be something like:

import { html, routes, app } from 'hyperapp'

const model = {}
const view = routes({
     "*": (model, msg) => {},
     "/": (model, msg) => {},
     "/:slug": (model, msg, params) => {}
    }
})

app({ model, view })

The new routes function should create a view (function) that selects the route proper view function using the browser history, and previously it registers the required event handlers, probably using the lifecycle events (more or less, the same code now it’s inside the app.js file)

What do you think?

Anyway, congrats for this nice library

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:20 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
jorgebucarancommented, Feb 10, 2017

@danigb You still want to get rid of the router?

Should we get rid of the router?

Please 👍 👎 .

2reactions
tunnckoCorecommented, Feb 6, 2017

But yea, in anyway it should be in the core. Because the purpose of the hyperapp is to be kinda “complete” solution for building apps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Routing to controller actions in ASP.NET Core - Microsoft Learn
Extracts the route values { controller = Products, action = Details, id = 5 } by tokenizing the path. The extraction of route...
Read more >
c# - Get the full route to current action - Stack Overflow
You can get the complete requested url using the Request option (HttpRequest) in .Net Core. var route = Request.Path.Value;. Your final code ......
Read more >
Routing in ASP.NET Core MVC - Code Maze
In this article, we're going to discuss the routing capabilities in ASP ... extract the route values { controller = Books, action =...
Read more >
Web API Routing - TutorialsTeacher
Learn about Web API routing here. Web API supports two types of routing: Convention-based Routing and Attribute Routing.
Read more >
ASP.NET Core Routing - Dot Net Tricks
These tokens get replaced by their values in the route table. ASP.NET Core Attribute Routing Token. Mixed Routing. You can use Convention-based ...
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