Skip to content

choko-org/redux-boot-express

Repository files navigation

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

About

Redux Boot module to use Express web server.

Resources

License

Stars

Watchers

Forks

Packages

No packages published