-
-
Notifications
You must be signed in to change notification settings - Fork 925
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Mithril Realworld Example App #1823
Comments
This is a neat idea, will take a look this evening and probably send a few PRs. |
Brilliant, thanks @tivac 👍 |
@tivac, take a look at: |
Hi everyone, just an update: TL;DR
I'm extremely excited about Mithril (have been using it in production for at least a year) and would love for it to become more mainstream, it's one of those libs that allows you to leave work at 17:00 👍 Thanks to everyone for helping to grow and maintain this project! |
|
|
Awesome! Thanks for the feedback @tivac
|
What about SSR? Do you plan to do this? I can assist in this space if you want |
Thanks for the feedback @orbitbot :)
|
@StephanHoyer Oh cool! Hadn't planned on it, but if you're offering... Then, hell yes! |
@tivac Re: 3. domain + api-adapter Do you mind posting a simple example of what your implementation looks like? |
Just my few cents for what it is worth. So following that principle, this var routes = {
'/': {
view: function () {
return m(LayoutDefault, m(ScreenHome));
}
},
'/article/:slug': {
view: function () {
return m(LayoutDefault, m(ScreenArticle));
}
},
'/register': {
view: function () {
return m(LayoutDefault, m(ScreenUserRegister));
}
...
} might be perhaps possible to shorten to var routes = {
'/': () => m(LayoutDefault, m(ScreenHome)),
'/article/:slug': () => m(LayoutDefault, m(ScreenArticle)),
'/register': () => m(LayoutDefault, m(ScreenUserRegister)),
...
} or even var routes = {
'/': LayoutDefault(ScreenHome),
'/article/:slug': LayoutDefault(ScreenArticle),
'/register': LayoutDefault(ScreenUserRegister),
...
} The last one would be a portable general syntax with no specific library dependency, You can even go "functionally crazy" and write it like var routeConfig = {
'/': ScreenHome,
'/article/:slug': ScreenArticle,
'/register': ScreenUserRegister,
...
}
var routes = R.map(LayoutDefault, routeConfig)
// or
var routes = routeConfig.map(LayoutDefault) From the code organisation perspective, the I have found the directory structure really well done in the angular real world example, with no directory having more than 10 or so files. Perhaps I would move the Another things that might make it easier to play and rearrange folders, var domain = require('./../../domain'); Nothing major, but could make life sweeter a bit :) Or am I missing any downside here? |
@dmitriz That's not how RouteResolvers work. They're a specifically-shaped object that mithril treats differently to enable persistent layout components. |
@tivac I am just saying it might be simpler to write the routes that way for the library consumer, so might be worth to support pure functions instead of the more verbose and complex components, where pure view functions is quite often (always in this app) all you need. Basically, there are two ways:
The first way would make it more user-friendly in my view. Does it make sense? |
Is there a reason for the Because Null is the Saruman of Static Typing. :) |
@dmitriz Thanks for the feedback, quite valuable discussion points.
Example This component: should probably live here:
|
Was just defining the shape of the state object, so that it's clear that some function is going to have to update that reference :) |
Re: absolute paths, methinky something like rollup's root import is what you'd want, if you're aware of it or not ;) |
Ah, yes, requires using es6 modules though? |
Perhaps in this specific case, there are probably alternatives for other environments & toolchains... |
You are welcome!
I can see your point. I still hope it can be made less verbose when staying simple. Also, does the router API not allow for any tree hierarchy, where I can put the
I am myself against deep nesting that are often abused with zillions of tiny files doing almost nothing. But your components are already 2 levels deep, so it wouldn't increase any depth with more subdirs inside |
RouteResolver: Something more like this? i.e. just DRYing the code up a bit?
|
That would look nicer to me! Or even restrict the router to the intermediate |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
I'm busying setting up a Mithril implementation of the Realworld app.
Would really appreciate feedback / contributions at barryels/realworld-mithril or (more high level) at: gothinkster/realworld#69
The text was updated successfully, but these errors were encountered: