All Projects → StephanHoyer → Mithril Isomorphic Example

StephanHoyer / Mithril Isomorphic Example

Licence: mit
Example of an isomorphic mithril application

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Mithril Isomorphic Example

Marko
A declarative, HTML-based language that makes building web apps fun
Stars: ✭ 10,796 (+9989.72%)
Mutual labels:  isomorphic, frontend
Vueniverse
Full stack, user based, PWA, Vue template.
Stars: ✭ 339 (+216.82%)
Mutual labels:  isomorphic, universal-app
Project Webcube
Continuously updated JS infrastructure for modern web dev
Stars: ✭ 141 (+31.78%)
Mutual labels:  isomorphic, universal-app
Typescript Hapi React Hot Loader Example
Simple TypeScript React Hot Loading example with Hapi Server-side rendering
Stars: ✭ 44 (-58.88%)
Mutual labels:  isomorphic, universal-app
server
Serve one or more react apps! - Custom routes, HotReloading, Authenticated Apps/routes, Relay, Webpack..
Stars: ✭ 20 (-81.31%)
Mutual labels:  isomorphic, universal-app
Hapi React Hot Loader Example
Simple React Hot Loading example with Hapi Server-side rendering
Stars: ✭ 44 (-58.88%)
Mutual labels:  isomorphic, universal-app
Rbb Website
Website to help connect black-owned businesses with consumers and resources
Stars: ✭ 101 (-5.61%)
Mutual labels:  frontend
Tachyons Verbose
Functional CSS for humans. Verbose edition.
Stars: ✭ 102 (-4.67%)
Mutual labels:  frontend
Mailwatch
MailWatch for MailScanner is a web-based front-end to MailScanner
Stars: ✭ 99 (-7.48%)
Mutual labels:  frontend
Mobile App
Color your memories
Stars: ✭ 99 (-7.48%)
Mutual labels:  frontend
Vue Relay
🖖 🔛 🗂 A framework for building GraphQL-driven Vue.js applications.
Stars: ✭ 105 (-1.87%)
Mutual labels:  frontend
Wasmplay
WASM Web "Framework" Playground
Stars: ✭ 105 (-1.87%)
Mutual labels:  frontend
Play2 Html5tags
HTML5 form tags module for Play Framework
Stars: ✭ 101 (-5.61%)
Mutual labels:  frontend
Awesome Seed Rs
A curated list of awesome things related to Seed
Stars: ✭ 101 (-5.61%)
Mutual labels:  frontend
Frontend knowledge
📚 Important Frontend Knowledge(前端知识汇总)
Stars: ✭ 103 (-3.74%)
Mutual labels:  frontend
Devextreme React
React UI and data visualization components
Stars: ✭ 100 (-6.54%)
Mutual labels:  frontend
Cyclow
A reactive frontend framework for JavaScript
Stars: ✭ 105 (-1.87%)
Mutual labels:  frontend
Material Design For Bootstrap
Important! A new UI Kit version for Bootstrap 5 is available. Access the latest free version via the link below.
Stars: ✭ 9,463 (+8743.93%)
Mutual labels:  frontend
Openseedbox
OpenSeedbox - Open Source Multi-User Bittorrent Web UI
Stars: ✭ 101 (-5.61%)
Mutual labels:  frontend
Node Frontend
Node.js Docker image with all Puppeteer dependencies installed for frontend Chrome Headless testing and default Nginx config, for multi-stage Docker building
Stars: ✭ 104 (-2.8%)
Mutual labels:  frontend

Join the chat at https://gitter.im/StephanHoyer/mithril-isomorphic-example

mithril-isomorphic-example

This is an example of an express-based isomorphic mithril application.

It utilizes the architecture descibed in this post. It can be used as a starting point for your isomorphic mithril-based application.

usage

  1. Clone the repo
  2. cd into it
  3. run npm install
  4. run npm start

If you want to run it in production mode (JS minification) just run NODE_ENV=production node server

components

frontend

It's a pretty standard mithril application. For packaging and dependencies we use browserify. The routes are defined in the routes.js. We added two routes for demonstration.

async data for rendering

Rendering async data is demonstrated in the second page. As you can see the route parameters come as vnode.attrs just like in browser mithril app. In order to render async you have to return a promise in the oninit. If this is resolved for all oninits, the response will be sent to the client.

function oninit(vnode) {
  return m.request(apiUrl + 'dog/' + 123).then(function(dog) {
    vnode.state.myDog = dog
  })
}

You can also use route resolver for this. We will add a third route that demonstrates this any time soon.

backend

REST-API

The app contains a basic REST-API based on express.

The API is bound to the base route api/v1/. This can of cause be changed in the server/web.js (also change it on the client side). It's currently just one possible route ('/dog/:id'). In a real application you probably make a config variable with your API-base URL so you can change it in one point.

conclusion

This project should give you a basic idea how to build a isomorphic app with express and mithril. We try to extract as much as possible to modules but stopped at this point, since more abstraction would result in more complicated code. This project is there to be adapted to your special use case. The code-base is pretty small and hopefully understandable.

Fell free to drop us a line in the gitter chat if you have any questions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].