0.23.0 • Published 8 years ago

protium v0.23.0

Weekly downloads
108
License
MIT
Repository
github
Last release
8 years ago

Protium

Protium is a micro framework for building universal React/Redux apps.

Bundles react, react-router, and redux into a nice little package, takes care of routing and store/reducer setup for you (more examples forthcoming).

Uses react-helmet for <head> management.

import {Helmet} from 'protium', and include that component within any of your views.

Example

webpack.config.js

var DevTools = require('protium/devtools').default

var devtools = new DevTools(__dirname) // sets webpack context for your app

module.exports = [
  devtools.serverConfig('./app'), // points to exported application
  devtools.browserConfig('./client')  // points to client entrypoint
]

app.js

import React from 'react'
import Root  from './views/root'
import Comp  from './views/comp'
import * as reducers from './reducers'
import { Application } from 'protium'
import {
  Router,
  Route,
  IndexRoute
} from 'protium/router'

const router = new Router({
  routes(store) { // use onEnter props to validate routes based on app state
    // Can also return a promise here, for async route definition
    return <Route path="/" component={Root}>
      <IndexRoute component={Comp} />
      <Route path="/a" component={Comp} />
      <Route path="/b" component={Comp} />
      <Route path="/c" component={Comp} />
      <Route path="*" component={NotFoundComp} notFound={true} /> // signals 404 on server
    </Route>
  }
})

export default new Application({
  router,
  store: {
    reducers
  }
})

client.js

// client.js (short and sweet!)
import app from './app'

app.render()
// server.js
import express       from 'express'
import path          from 'path'
import { renderer }  from 'protium/server'
import app           from './app'

const server = express()
export default server

server.use('/assets', express.static('dist'))
server.get('/*', renderer(path.resolve('./app.js'), {
  page: {
    main: require('./webpack-assets.json').javascript.client
  }
}))
0.23.0

8 years ago

0.22.1

8 years ago

0.22.0

9 years ago

0.22.0-0

9 years ago

0.20.0

9 years ago

0.20.0-2

9 years ago

0.20.0-1

9 years ago

0.20.0-0

9 years ago

0.19.5

9 years ago

0.19.4

9 years ago

0.19.3

9 years ago

0.19.2

9 years ago

0.19.1

9 years ago

0.19.0

9 years ago

0.18.5

9 years ago

0.18.4

9 years ago

0.18.3

9 years ago

0.18.2

9 years ago

0.18.1

9 years ago

0.18.0

9 years ago

0.16.6

9 years ago

0.16.5

9 years ago

0.16.4

9 years ago

0.16.3

9 years ago

0.16.2

9 years ago

0.16.1

9 years ago

0.15.13

9 years ago

0.15.12

9 years ago

0.16.0

9 years ago

0.15.11

9 years ago

0.15.10

9 years ago

0.15.9

9 years ago

0.15.8

9 years ago

0.15.7

9 years ago

0.15.6

9 years ago

0.15.5

9 years ago

0.15.4

9 years ago

0.15.3

9 years ago

0.14.19

9 years ago

0.14.18

9 years ago

0.14.17

9 years ago

0.14.16

9 years ago

0.15.2

9 years ago

0.15.1

9 years ago

0.15.0

9 years ago

0.14.15

9 years ago

0.14.14

9 years ago

0.14.13

9 years ago

0.14.12

9 years ago

0.14.11

9 years ago

0.14.10

9 years ago

0.14.9

9 years ago

0.14.8

9 years ago

0.14.7

9 years ago

0.14.6

9 years ago

0.14.5

9 years ago

0.14.4

9 years ago

0.14.3

9 years ago

0.14.2

9 years ago

0.14.1

9 years ago

0.14.0

9 years ago

0.13.0

9 years ago

0.12.0

9 years ago

0.11.3

9 years ago

0.11.2

9 years ago

0.11.1

9 years ago

0.11.0

9 years ago

0.10.13

9 years ago

0.10.12

9 years ago

0.10.11

9 years ago

0.10.10

9 years ago

0.10.9

9 years ago

0.10.8

9 years ago

0.10.7

9 years ago

0.10.6

9 years ago

0.10.5

9 years ago

0.10.4

10 years ago

0.10.3

10 years ago

0.10.2

10 years ago

0.10.1

10 years ago

0.10.0

10 years ago

0.9.0

10 years ago

0.8.1

10 years ago

0.8.0

10 years ago

0.7.3

10 years ago

0.7.2

10 years ago

0.7.1

10 years ago

0.7.0

10 years ago

0.6.2

10 years ago

0.6.1

10 years ago

0.6.0

10 years ago

0.5.9

10 years ago

0.5.8

10 years ago

0.5.7

10 years ago

0.5.6

10 years ago

0.5.5

10 years ago

0.5.4

10 years ago

0.5.3

10 years ago

0.5.2

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago

0.1.0

10 years ago