{"id":16844774,"url":"https://github.com/stephanhoyer/mithril-isomorphic-example","last_synced_at":"2025-04-05T13:07:46.616Z","repository":{"id":26988425,"uuid":"30452264","full_name":"StephanHoyer/mithril-isomorphic-example","owner":"StephanHoyer","description":"Example of an isomorphic mithril application","archived":false,"fork":false,"pushed_at":"2025-03-23T06:29:36.000Z","size":161,"stargazers_count":109,"open_issues_count":8,"forks_count":15,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-29T12:08:12.519Z","etag":null,"topics":["frontend","isomorphic","javascript","mithril","universal-app"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StephanHoyer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-07T10:16:22.000Z","updated_at":"2024-12-17T10:30:24.000Z","dependencies_parsed_at":"2023-11-13T06:24:48.084Z","dependency_job_id":"be0f41d2-8d1d-4d40-ac5b-e231aa07dbbc","html_url":"https://github.com/StephanHoyer/mithril-isomorphic-example","commit_stats":{"total_commits":98,"total_committers":9,"mean_commits":10.88888888888889,"dds":0.6122448979591837,"last_synced_commit":"f1145248ba2ca01f928d3f8576a1109d014d1e09"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephanHoyer%2Fmithril-isomorphic-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephanHoyer%2Fmithril-isomorphic-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephanHoyer%2Fmithril-isomorphic-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephanHoyer%2Fmithril-isomorphic-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StephanHoyer","download_url":"https://codeload.github.com/StephanHoyer/mithril-isomorphic-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339158,"owners_count":20923014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["frontend","isomorphic","javascript","mithril","universal-app"],"created_at":"2024-10-13T12:56:34.016Z","updated_at":"2025-04-05T13:07:46.598Z","avatar_url":"https://github.com/StephanHoyer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Join the chat at https://gitter.im/StephanHoyer/mithril-isomorphic-example](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/StephanHoyer/mithril-isomorphic-example?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n# mithril-isomorphic-example\n\nThis is an example of an express-based isomorphic mithril application.\n\nIt utilizes the architecture descibed in\n[this](https://gist.github.com/StephanHoyer/bddccd9e159828867d2a) post. It can\nbe used as a starting point for your isomorphic mithril-based application.\n\n# usage\n\n1. Clone the repo\n2. `cd` into it\n3. run `npm install`\n4. run `npm start`\n\nIf you want to run it in production mode (JS minification) just run `NODE_ENV=production node server`\n\n# components\n\n## frontend\n\nIt's a pretty standard mithril application. For packaging and dependencies we use\n[browserify](http://browserify.org/). The routes are defined in the `routes.js`.\nWe added two routes for demonstration.\n\n### async data for rendering\n\nRendering async data is demonstrated in the second page. As you can see the\nroute parameters come as `vnode.attrs` just like in browser mithril app. In order\nto render async you have to return a promise in the `oninit`. If this is \nresolved for all `oninit`s, the response will be sent to the client.\n\n```javascript\nfunction oninit(vnode) {\n  return m.request(apiUrl + 'dog/' + 123).then(function(dog) {\n    vnode.state.myDog = dog\n  })\n}\n```\n\nYou can also use route resolver for this. We will add a third route that\ndemonstrates this any time soon.\n\n## backend\n\n### REST-API\n\nThe app contains a basic REST-API based on `express`.\n\nThe API is bound to the base route `api/v1/`. This can of cause be changed in\nthe `server/web.js` (also change it on the client side). It's currently just one\npossible route ('/dog/:id'). In a real application you probably make a config\nvariable with your API-base URL so you can change it in one point.\n\n# conclusion\n\nThis project should give you a basic idea how to build a isomorphic app with\nexpress and mithril. We try to extract as much as possible to modules but stopped\nat this point, since more abstraction would result in more complicated code. This\nproject is there to be adapted to your special use case. The code-base is pretty\nsmall and hopefully understandable.\n\nFell free to drop us a line in the gitter chat if you have any questions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephanhoyer%2Fmithril-isomorphic-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephanhoyer%2Fmithril-isomorphic-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephanhoyer%2Fmithril-isomorphic-example/lists"}