Giter Club home page Giter Club logo

realworld-mithril's Introduction

RealWorld Example App

Mithril codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

This codebase was created to demonstrate a fully fledged fullstack application built with Mithril including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the Mithril community styleguides & best practices.

For more information on how this works with other frontends/backends, head over to the RealWorld repo.

How it works

10 000 Foot View


                    +---------------+
                    |               |
            +------->  Component X  +-------+
            |       |               |       |
            |       +---------------+       |
            |                               |
 [store.prop reference]               (function call)
            |                               |
            |    +--------------------+     |
            |    |                    |     |
            -----+       domain       <-----+
                 |                    |
                 |    Updates its     |
                 |   internal state   |
                 |   in response to   |
                 |      API data      |
                 |                    |
                 +----------^---------+
                            |
                            |
                            V
                    (External API(s))

domain/index.js

Handles app-level concerns and is UI agnostic. It handles communication with the external API (which should be abstracted away into a separate module for larger apps). It has a basic store data object which can be (relatively) easily replaced by Redux, mobX, etc. with/out Immutable data structures. It has two public interfaces:

  • store is a way to read values
  • actions has a set of functions which can be called in order to mutate state

ui/router.js

[TODO Add detail]

ui/components/*.js

[TODO Add detail]

Getting started

You can view a live demo over at realworld-mithril.netlify.com

To get the frontend running locally:

  • Clone this repo
  • Run $ npm install to install all the required dependencies
  • Run $ npm start to start the local server and JS build

realworld-mithril's People

Contributors

alonski avatar anishkny avatar barryels avatar ericsimons avatar esakkiraj avatar willycamargo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

realworld-mithril's Issues

Using npm start, localhost:3000 doesn't work

I've installed Node.js -v 6.10.2 and npm -v 3.10.10

And I've used following steps to install:

  1. git clone https://github.com/barryels/realworld-mithril.git
  2. cd realworld-mithril
  3. npm install
  4. npm start

Step 4 doesn't show any error, but http://localhost:3000 doesn't work!

When searching for any solutions for this, I found the following command, using which the application shows up in browser:
node ./node_modules/http-server/bin/http-server public -p 3000 -s
But I'm not sure if this is the proper approach to this.

I'm very much new to Mithril or any JS Framework, So I really appreciate any help in getting started here. Thanks

Suggestion: use browser's event delegation system for forms

Hi,

I am a regular lurker into the Mithril gitter channel and saw you mentioning your project.
Leo (Mithril's creator) has been quite an inspiration and helped me quite a bit on improving my understanding of javascript, the DOM etc...
I thought I would point you to his previous blog where he distilled some nuggets of his wisdom, notably how to avoid lots of repetitions in forms when having multiple inputs.

This was written for the old Mithril so ctrl up to Mithril 0.2 should be replaced by vnode.state most of the time in Mithril 1.0.

His previous blog was really a great source of ideas, most of them have been incorporated into the new Mithril documentation but not the one above as far as I am aware.

Hope this helps,

Cheers

Cannot find modules?

[email protected] ui-build-js-watch /Users/dmitrizaitsev/Repos/realworld-mithril
watchify src/index.js --debug --verbose -o public/main.js

Error: Cannot find module 'xss-filters' from '/Users/dmitrizaitsev/Repos/realworld-mithril/src/ui'
Error: Cannot find module 'dateformat' from '/Users/dmitrizaitsev/Repos/realworld-mithril/src/ui'
Error: Cannot find module 'marked' from '/Users/dmitrizaitsev/Repos/realworld-mithril/src/ui'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.