Consider extract the routing code from core
See original GitHub issueHi @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:
- Created 7 years ago
- Reactions:5
- Comments:20 (13 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@danigb You still want to get rid of the router?
Should we get rid of the router?
Please 👍 👎 .
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.