0.1.4 • Published 8 years ago

redux-boot-express v0.1.4

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

Redux Boot Express

Build Status

Redux Boot module to use Express web server.

Install

npm install redux-boot-express --save

Actions constants

import {
  HTTP_REQUEST,
  HTTP_BOOT,
  HTTP_AFTER_BOOT
} from 'redux-boot-express'

Usage

import boot from 'redux-boot'
import webServerModule, {HTTP_REQUEST} from 'redux-boot-express'

const helloModule = {
  middleware({getState, dispatch}) {
    return next => action => {
      let nextResult = next(action)

      if (action.type === HTTP_REQUEST) {
        const {request, response} = action.payload
        response.send('Hello!')
      }

      return nextResult
    }
  }
}

const initialState = {
  variables: {
    port: 3020
  }
}

const modules = [
  webServerModule,
  helloModule
]

const app = boot(initialState, modules)

License

MIT