GithubHelp home page GithubHelp logo

reddit-mobile's Introduction

reddit-mobile

reddit-mobile is a web server and build system for building polymorphic React applications in node or io.js. It is part of a larger series of plugins that, together, form frontend applications for reddit.

A Brief Overview

This application provides the core to set up an Express web server and html5 history api, and have these send a request object (containing path, data, etc) and a callback (a promise interface) to the App.

This application also provides a build system and a base css framework, shared across plugins.

 +---------+          +---------------+
 | express |          | html5 history |
 +---------+          |     api       |
    |                 +---------------+
 req, cb                   req, cb
    |                        |
    \                        /
     ------------------------
                |
                v
            +--------+
            | App.js |
            +--------+
                |
             (router)
                |
                v
            +--------+
            | plugin | -> cb.resolve({ body: reactElement })
            |        | -> cb.reject({ status: 401 })
            +--------+ 

The App has an instance of an Express-like request router that it uses to map requests to the appropriate handling function, and is run on both the client- and server- side. The React lifecycle can be used to control client-specific code.

Plugins register themselves via two interfaces:

  1. Route handlers that take two paramaters, req and res. res is a promise interface that should be called using res.resolve({ body: reactElement, status: 200}) or res.reject({ body: error, status: 400}). (Body and status are optional in both cases, but should generally be added.) A complete example of route handling can be seen at routes.jsx.
  2. Mutators that modify the rendering of react components. An element query syntax is provided, documentation forthcoming.

Getting Up and Running

  1. Install node.js v0.12+ or io.js v1.8.1+.
  2. Fork and clone this project.
  3. Run npm install to install other dependencies.
  4. Run git submodule update --init to download this project's submodules.
  5. Run npm run build to build the assets (npm run watch to set up a filesystem watcher.)
  6. Register a new oauth application and set up your environment variables
  7. Run npm start to start the web server. Optionally, create a startup script at start.sh that sets environment variables and starts the server; start.sh has been added to the .gitignore and will not get checked in.

reddit-mobile's People

Contributors

ajacksified avatar arresteddevelopment avatar btholt avatar curioussavage avatar danehansen avatar dwick avatar foligno avatar jordanmilne avatar justinnichols avatar milkshoes avatar russjr08 avatar spladug avatar zeantsoi avatar

Watchers

 avatar  avatar

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.