0.23.0 • Published 7 years ago

protium v0.23.0

Weekly downloads
108
License
MIT
Repository
github
Last release
7 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

7 years ago

0.22.1

7 years ago

0.22.0

7 years ago

0.22.0-0

7 years ago

0.20.0

7 years ago

0.20.0-2

7 years ago

0.20.0-1

7 years ago

0.20.0-0

7 years ago

0.19.5

7 years ago

0.19.4

8 years ago

0.19.3

8 years ago

0.19.2

8 years ago

0.19.1

8 years ago

0.19.0

8 years ago

0.18.5

8 years ago

0.18.4

8 years ago

0.18.3

8 years ago

0.18.2

8 years ago

0.18.1

8 years ago

0.18.0

8 years ago

0.16.6

8 years ago

0.16.5

8 years ago

0.16.4

8 years ago

0.16.3

8 years ago

0.16.2

8 years ago

0.16.1

8 years ago

0.15.13

8 years ago

0.15.12

8 years ago

0.16.0

8 years ago

0.15.11

8 years ago

0.15.10

8 years ago

0.15.9

8 years ago

0.15.8

8 years ago

0.15.7

8 years ago

0.15.6

8 years ago

0.15.5

8 years ago

0.15.4

8 years ago

0.15.3

8 years ago

0.14.19

8 years ago

0.14.18

8 years ago

0.14.17

8 years ago

0.14.16

8 years ago

0.15.2

8 years ago

0.15.1

8 years ago

0.15.0

8 years ago

0.14.15

8 years ago

0.14.14

8 years ago

0.14.13

8 years ago

0.14.12

8 years ago

0.14.11

8 years ago

0.14.10

8 years ago

0.14.9

8 years ago

0.14.8

8 years ago

0.14.7

8 years ago

0.14.6

8 years ago

0.14.5

8 years ago

0.14.4

8 years ago

0.14.3

8 years ago

0.14.2

8 years ago

0.14.1

8 years ago

0.14.0

8 years ago

0.13.0

8 years ago

0.12.0

8 years ago

0.11.3

8 years ago

0.11.2

8 years ago

0.11.1

8 years ago

0.11.0

8 years ago

0.10.13

8 years ago

0.10.12

8 years ago

0.10.11

8 years ago

0.10.10

8 years ago

0.10.9

8 years ago

0.10.8

8 years ago

0.10.7

8 years ago

0.10.6

8 years ago

0.10.5

8 years ago

0.10.4

8 years ago

0.10.3

8 years ago

0.10.2

8 years ago

0.10.1

8 years ago

0.10.0

8 years ago

0.9.0

8 years ago

0.8.1

8 years ago

0.8.0

8 years ago

0.7.3

8 years ago

0.7.2

8 years ago

0.7.1

8 years ago

0.7.0

8 years ago

0.6.2

8 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.5.9

8 years ago

0.5.8

8 years ago

0.5.7

8 years ago

0.5.6

8 years ago

0.5.5

8 years ago

0.5.4

8 years ago

0.5.3

8 years ago

0.5.2

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.1.0

8 years ago