koiki
Koiki
Last updated a year ago by sideroad .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install koiki 
SYNC missed versions from official npm registry.

Even faster React/Redux development

Installation

npm i --save koiki

Usage

koiki.server / koiki.client

Parameter Type Meaning Place to specify Remark
urls Object Resource URLs client / server
reducers Object Reducers client / server
routes Object Routes client / server
isDevelopment Boolean Development Flag (For debug) client / server
manifest Object Extend manifest.json setting server
app Object Instance of express server
path String Root URI server
origin String Origin URL server
i18ndir String i18n properties directory path server
handlers Object - server
handlers.error Function Error callback server

How to apply Authentication?

import { passporter } from 'koiki';
import express from 'express';

const app = express();
passporter.use({
  github: {
    appId: 'PLEASE SET GITHUB API CLIENT ID',
    secret: 'PLEASE SET GITHUB API SECRET ID',
  }
}, app, originUrl);

How to fetch resources?

Define URLs in urls.js

{
  person: {
    gets: {
      method: 'GET',
      url: 'https://chaus.herokuapp.com/apis/koiki/people'
    },
    create: {
      method: 'POST',
      url: 'https://chaus.herokuapp.com/apis/koiki/people'      
    }
  }
}

First layer property will be use as of person resource. Second layer property will be use as of gets action. ( action name will be captalized )

You can call fetcher.person.gets from asyncConnect or containers context.

Then result will be call with actions below.

  • When resource start to fetch call 'person/GETS_START' action
  • When getting resource has been succeeded, 'person/GETS_SUCCESS' action.
  • When getting resource has been failed, 'person/GETS_FAILED' action.

Example below.

fetcher.person.gets({
  age: 25
});

fetcher will be response Promise object. So you can do like this.

fetcher.person.save({
  name: 'foo'
  age: 25
}).then(
  () => fetcher.person.gets()
);

Setup reducer to set onto store.

Responsed object can get from action.body. action.res has Fetch API's responsed object.

export default function reducer(state = initialState, action = {}) {
  ...
  case GETS_SUCCESS:
    return {
      ...state,
      loading: false,
      loaded: true,
      items: action.body.items
    };
  ...

Advanced Usage

You can write after / override / next properties under urls object to customize fetcher logic.

next

When resource has hypermedia link, we can call fetcher.person.gets.next() to get next items.

Set next method under urls third layer

{
  person: {
    gets: {
      method: 'GET',
      url: 'https://chaus.herokuapp.com/apis/koiki/people',

      /* If API response next paging resource such as
       * {
       *   paging: {
       *     next: 'https://....'
       *   }
       * }
      */
      next: action => action.body.paging.next
    },
  },
  ...
}

We can use fetcher.person.gets.next after called fetcher.person.gets on containers.

Breaking change

v6.0.0

  • Add Authentication feature

v5.0.0

  • Update webpack version to 2
  • bin/server.js, config for webpack directory no longer used anymore.
  • .babelrc, server.babel.js no longer used anymore.
  • .koikirc can be use to override webpack settings.
  • webpack dependencies does not installed app self
  • Be able to inject environment values onto bundled file which started with KOIKI_ prefix. ( Keep it mind that the value will be public in browser side ). If it is only used in server side, do not add the prefix.

See below to know example https://github.com/sideroad/floras/commit/68ee25cccdc94cc5bbb544d7f6e99842a6ff3300 https://github.com/sideroad/corkpin/commit/e5eeb7f46d6382dd27ce5622c2a60e0a01bc3194

v4.0.0

  • fetcher callback object is deeper than before.
  • Before
    • then callback only get response JSON object.
    • after callback only get response JSON object.
    • success dispatched callback has action.res from response JSON object.
  • After
    • then callback gets { body: response JSON object, res: fetch response object }
    • after callback gets { body: response JSON object, res: fetch response object }
    • success dispatched callback has action.res from fetch response object.
    • success dispatched callback has action.body from response JSON object.
    • error dispatched callback has action.res from fetch response object.
    • error dispatched callback has action.body from response JSON object.

Current Tags

  • 6.3.5                                ...           latest (a year ago)

401 Versions

  • 6.3.5                                ...           a year ago
  • 6.3.4                                ...           a year ago
  • 6.3.3                                ...           a year ago
  • 6.3.2                                ...           a year ago
  • 6.3.1                                ...           2 years ago
  • 6.3.0                                ...           2 years ago
  • 6.2.0                                ...           2 years ago
  • 6.1.5                                ...           2 years ago
  • 6.1.4                                ...           2 years ago
  • 6.1.3                                ...           2 years ago
  • 6.1.2                                ...           2 years ago
  • 6.1.1                                ...           2 years ago
  • 6.1.0                                ...           2 years ago
  • 6.0.30                                ...           2 years ago
  • 6.0.29                                ...           2 years ago
  • 6.0.28                                ...           2 years ago
  • 6.0.27                                ...           2 years ago
  • 6.0.26                                ...           2 years ago
  • 6.0.25                                ...           2 years ago
  • 6.0.24                                ...           2 years ago
  • 6.0.23                                ...           2 years ago
  • 6.0.22                                ...           2 years ago
  • 6.0.21                                ...           2 years ago
  • 6.0.20                                ...           2 years ago
  • 6.0.19                                ...           2 years ago
  • 6.0.18                                ...           2 years ago
  • 6.0.17                                ...           2 years ago
  • 6.0.16                                ...           2 years ago
  • 6.0.15                                ...           2 years ago
  • 6.0.14                                ...           2 years ago
  • 6.0.13                                ...           2 years ago
  • 6.0.12                                ...           2 years ago
  • 6.0.11                                ...           2 years ago
  • 6.0.10                                ...           2 years ago
  • 6.0.9                                ...           2 years ago
  • 6.0.8                                ...           2 years ago
  • 6.0.7                                ...           2 years ago
  • 6.0.6                                ...           2 years ago
  • 6.0.5                                ...           2 years ago
  • 6.0.4                                ...           2 years ago
  • 6.0.3                                ...           2 years ago
  • 6.0.2                                ...           2 years ago
  • 6.0.1                                ...           2 years ago
  • 6.0.0                                ...           2 years ago
  • 5.3.9                                ...           2 years ago
  • 5.3.8                                ...           2 years ago
  • 5.3.7                                ...           2 years ago
  • 5.3.6                                ...           2 years ago
  • 5.3.5                                ...           2 years ago
  • 5.3.4                                ...           2 years ago
  • 5.3.3                                ...           2 years ago
  • 5.3.2                                ...           2 years ago
  • 5.3.1                                ...           2 years ago
  • 5.3.0                                ...           2 years ago
  • 5.2.1                                ...           2 years ago
  • 5.2.0                                ...           2 years ago
  • 5.1.2                                ...           2 years ago
  • 5.1.1                                ...           2 years ago
  • 5.1.0                                ...           2 years ago
  • 5.0.7                                ...           2 years ago
  • 5.0.6                                ...           2 years ago
  • 5.0.5                                ...           2 years ago
  • 5.0.4                                ...           3 years ago
  • 5.0.3                                ...           3 years ago
  • 5.0.2                                ...           3 years ago
  • 5.0.1                                ...           3 years ago
  • 5.0.0                                ...           3 years ago
  • 5.0.0-rc.8                                ...           3 years ago
  • 5.0.0-rc.7                                ...           3 years ago
  • 5.0.0-rc.6                                ...           3 years ago
  • 5.0.0-rc.5                                ...           3 years ago
  • 5.0.0-rc.4                                ...           3 years ago
  • 5.0.0-rc.3                                ...           3 years ago
  • 5.0.0-rc.2                                ...           3 years ago
  • 5.0.0-rc.1                                ...           3 years ago
  • 4.3.18                                ...           3 years ago
  • 4.3.17                                ...           3 years ago
  • 4.3.16                                ...           3 years ago
  • 4.3.15                                ...           3 years ago
  • 4.3.14                                ...           3 years ago
  • 4.3.13                                ...           3 years ago
  • 4.3.12                                ...           3 years ago
  • 4.3.11                                ...           3 years ago
  • 4.3.10                                ...           3 years ago
  • 4.3.9                                ...           3 years ago
  • 4.3.8                                ...           3 years ago
  • 4.3.7                                ...           3 years ago
  • 4.3.6                                ...           3 years ago
  • 4.3.5                                ...           3 years ago
  • 4.3.4                                ...           3 years ago
  • 4.3.3                                ...           3 years ago
  • 4.3.2                                ...           3 years ago
  • 4.3.1                                ...           3 years ago
  • 4.3.0                                ...           3 years ago
  • 4.2.0                                ...           3 years ago
  • 4.1.12                                ...           3 years ago
  • 4.1.11                                ...           3 years ago
  • 4.1.11-rc2                                ...           3 years ago
  • 4.1.11-rc1                                ...           3 years ago
  • 4.1.10                                ...           3 years ago
  • 4.1.9                                ...           3 years ago
  • 4.1.8                                ...           3 years ago
  • 4.1.7                                ...           3 years ago
  • 4.1.6                                ...           3 years ago
  • 4.1.5                                ...           3 years ago
  • 4.1.5-rc6                                ...           3 years ago
  • 4.1.5-rc5                                ...           3 years ago
  • 4.1.5-rc4                                ...           3 years ago
  • 4.1.5-rc3                                ...           3 years ago
  • 4.1.5-rc2                                ...           3 years ago
  • 4.1.5-rc1                                ...           3 years ago
  • 4.1.4                                ...           3 years ago
  • 4.1.3                                ...           3 years ago
  • 4.1.2                                ...           3 years ago
  • 4.1.1                                ...           3 years ago
  • 4.1.0                                ...           3 years ago
  • 4.0.4                                ...           3 years ago
  • 4.0.3                                ...           3 years ago
  • 4.0.2                                ...           3 years ago
  • 4.0.1                                ...           3 years ago
  • 4.0.0                                ...           3 years ago
  • 3.1.5                                ...           3 years ago
  • 3.1.4                                ...           3 years ago
  • 3.1.4-rc2                                ...           3 years ago
  • 3.1.4-rc                                ...           3 years ago
  • 3.1.3                                ...           3 years ago
  • 3.1.1                                ...           3 years ago
  • 3.1.0                                ...           3 years ago
  • 3.0.2                                ...           3 years ago
  • 3.0.1                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 2.7.2                                ...           3 years ago
  • 2.7.1                                ...           3 years ago
  • 2.7.0                                ...           3 years ago
  • 2.6.0                                ...           3 years ago
  • 2.5.2                                ...           3 years ago
  • 2.5.1                                ...           3 years ago
  • 2.5.0                                ...           3 years ago
  • 2.4.6                                ...           3 years ago
  • 2.4.5                                ...           3 years ago
  • 2.4.4                                ...           3 years ago
  • 2.4.3                                ...           3 years ago
  • 2.4.2                                ...           3 years ago
  • 2.4.1                                ...           3 years ago
  • 2.4.0                                ...           3 years ago
  • 2.3.6                                ...           3 years ago
  • 2.3.5                                ...           3 years ago
  • 2.3.4                                ...           3 years ago
  • 2.3.3                                ...           3 years ago
  • 2.3.2                                ...           3 years ago
  • 2.3.1                                ...           3 years ago
  • 2.3.0                                ...           3 years ago
  • 2.2.0                                ...           3 years ago
  • 2.1.5                                ...           3 years ago
  • 2.1.4                                ...           3 years ago
  • 2.1.3                                ...           3 years ago
  • 2.1.2                                ...           3 years ago
  • 2.1.1                                ...           3 years ago
  • 2.1.0                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.5.3                                ...           3 years ago
  • 1.5.2                                ...           3 years ago
  • 1.5.1                                ...           3 years ago
  • 1.5.0                                ...           3 years ago
  • 1.4.1                                ...           3 years ago
  • 1.4.0                                ...           3 years ago
  • 1.3.0                                ...           3 years ago
  • 1.2.16                                ...           3 years ago
  • 1.2.15                                ...           3 years ago
  • 1.2.14                                ...           3 years ago
  • 1.2.13                                ...           3 years ago
  • 1.2.12                                ...           3 years ago
  • 1.2.11                                ...           3 years ago
  • 1.2.10                                ...           3 years ago
  • 1.2.9                                ...           3 years ago
  • 1.2.8                                ...           3 years ago
  • 1.2.7                                ...           3 years ago
  • 1.2.6                                ...           3 years ago
  • 1.2.5                                ...           3 years ago
  • 1.2.4                                ...           3 years ago
  • 1.2.3                                ...           3 years ago
  • 1.2.2                                ...           3 years ago
  • 1.2.1                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.0.217                                ...           3 years ago
  • 1.0.216                                ...           3 years ago
  • 1.0.215                                ...           3 years ago
  • 1.0.214                                ...           3 years ago
  • 1.0.213                                ...           3 years ago
  • 1.0.212                                ...           3 years ago
  • 1.0.211                                ...           3 years ago
  • 1.0.210                                ...           3 years ago
  • 1.0.209                                ...           3 years ago
  • 1.0.208                                ...           3 years ago
  • 1.0.207                                ...           3 years ago
  • 1.0.206                                ...           3 years ago
  • 1.0.205                                ...           3 years ago
  • 1.0.204                                ...           3 years ago
  • 1.0.203                                ...           3 years ago
  • 1.0.202                                ...           3 years ago
  • 1.0.201                                ...           3 years ago
  • 1.0.200                                ...           3 years ago
  • 1.0.199                                ...           3 years ago
  • 1.0.198                                ...           3 years ago
  • 1.0.197                                ...           3 years ago
  • 1.0.196                                ...           3 years ago
  • 1.0.195                                ...           3 years ago
  • 1.0.194                                ...           3 years ago
  • 1.0.193                                ...           3 years ago
  • 1.0.192                                ...           3 years ago
  • 1.0.191                                ...           3 years ago
  • 1.0.190                                ...           3 years ago
  • 1.0.189                                ...           3 years ago
  • 1.0.188                                ...           3 years ago
  • 1.0.187                                ...           3 years ago
  • 1.0.186                                ...           3 years ago
  • 1.0.185                                ...           3 years ago
  • 1.0.184                                ...           3 years ago
  • 1.0.183                                ...           3 years ago
  • 1.0.182                                ...           3 years ago
  • 1.0.181                                ...           3 years ago
  • 1.0.180                                ...           3 years ago
  • 1.0.179                                ...           3 years ago
  • 1.0.178                                ...           3 years ago
  • 1.0.177                                ...           3 years ago
  • 1.0.176                                ...           3 years ago
  • 1.0.175                                ...           3 years ago
  • 1.0.174                                ...           3 years ago
  • 1.0.173                                ...           3 years ago
  • 1.0.172                                ...           3 years ago
  • 1.0.171                                ...           3 years ago
  • 1.0.170                                ...           3 years ago
  • 1.0.169                                ...           3 years ago
  • 1.0.168                                ...           3 years ago
  • 1.0.167                                ...           3 years ago
  • 1.0.166                                ...           3 years ago
  • 1.0.165                                ...           3 years ago
  • 1.0.164                                ...           3 years ago
  • 1.0.163                                ...           3 years ago
  • 1.0.162                                ...           3 years ago
  • 1.0.161                                ...           3 years ago
  • 1.0.160                                ...           3 years ago
  • 1.0.159                                ...           3 years ago
  • 1.0.158                                ...           3 years ago
  • 1.0.157                                ...           3 years ago
  • 1.0.156                                ...           3 years ago
  • 1.0.155                                ...           3 years ago
  • 1.0.154                                ...           3 years ago
  • 1.0.153                                ...           3 years ago
  • 1.0.152                                ...           3 years ago
  • 1.0.151                                ...           3 years ago
  • 1.0.150                                ...           3 years ago
  • 1.0.149                                ...           3 years ago
  • 1.0.148                                ...           3 years ago
  • 1.0.147                                ...           3 years ago
  • 1.0.146                                ...           3 years ago
  • 1.0.145                                ...           3 years ago
  • 1.0.144                                ...           3 years ago
  • 1.0.143                                ...           3 years ago
  • 1.0.142                                ...           3 years ago
  • 1.0.141                                ...           3 years ago
  • 1.0.140                                ...           3 years ago
  • 1.0.139                                ...           3 years ago
  • 1.0.138                                ...           3 years ago
  • 1.0.137                                ...           3 years ago
  • 1.0.136                                ...           3 years ago
  • 1.0.135                                ...           3 years ago
  • 1.0.134                                ...           3 years ago
  • 1.0.133                                ...           3 years ago
  • 1.0.132                                ...           3 years ago
  • 1.0.131                                ...           3 years ago
  • 1.0.130                                ...           3 years ago
  • 1.0.129                                ...           3 years ago
  • 1.0.128                                ...           3 years ago
  • 1.0.127                                ...           3 years ago
  • 1.0.126                                ...           3 years ago
  • 1.0.125                                ...           3 years ago
  • 1.0.124                                ...           3 years ago
  • 1.0.123                                ...           3 years ago
  • 1.0.122                                ...           3 years ago
  • 1.0.121                                ...           3 years ago
  • 1.0.120                                ...           3 years ago
  • 1.0.119                                ...           3 years ago
  • 1.0.118                                ...           3 years ago
  • 1.0.117                                ...           3 years ago
  • 1.0.116                                ...           3 years ago
  • 1.0.115                                ...           3 years ago
  • 1.0.114                                ...           3 years ago
  • 1.0.113                                ...           3 years ago
  • 1.0.112                                ...           3 years ago
  • 1.0.111                                ...           3 years ago
  • 1.0.110                                ...           3 years ago
  • 1.0.109                                ...           3 years ago
  • 1.0.108                                ...           3 years ago
  • 1.0.107                                ...           3 years ago
  • 1.0.106                                ...           3 years ago
  • 1.0.105                                ...           3 years ago
  • 1.0.104                                ...           3 years ago
  • 1.0.103                                ...           3 years ago
  • 1.0.102                                ...           3 years ago
  • 1.0.101                                ...           3 years ago
  • 1.0.100                                ...           3 years ago
  • 1.0.99                                ...           3 years ago
  • 1.0.98                                ...           3 years ago
  • 1.0.97                                ...           3 years ago
  • 1.0.96                                ...           3 years ago
  • 1.0.95                                ...           3 years ago
  • 1.0.94                                ...           3 years ago
  • 1.0.93                                ...           3 years ago
  • 1.0.92                                ...           3 years ago
  • 1.0.91                                ...           3 years ago
  • 1.0.90                                ...           3 years ago
  • 1.0.89                                ...           3 years ago
  • 1.0.88                                ...           3 years ago
  • 1.0.87                                ...           3 years ago
  • 1.0.86                                ...           3 years ago
  • 1.0.85                                ...           3 years ago
  • 1.0.84                                ...           3 years ago
  • 1.0.83                                ...           3 years ago
  • 1.0.82                                ...           3 years ago
  • 1.0.81                                ...           3 years ago
  • 1.0.80                                ...           3 years ago
  • 1.0.79                                ...           3 years ago
  • 1.0.78                                ...           3 years ago
  • 1.0.77                                ...           3 years ago
  • 1.0.76                                ...           3 years ago
  • 1.0.75                                ...           3 years ago
  • 1.0.74                                ...           3 years ago
  • 1.0.73                                ...           3 years ago
  • 1.0.72                                ...           3 years ago
  • 1.0.71                                ...           3 years ago
  • 1.0.70                                ...           3 years ago
  • 1.0.69                                ...           3 years ago
  • 1.0.68                                ...           3 years ago
  • 1.0.67                                ...           3 years ago
  • 1.0.66                                ...           3 years ago
  • 1.0.65                                ...           3 years ago
  • 1.0.64                                ...           3 years ago
  • 1.0.63                                ...           3 years ago
  • 1.0.62                                ...           3 years ago
  • 1.0.61                                ...           3 years ago
  • 1.0.60                                ...           3 years ago
  • 1.0.59                                ...           3 years ago
  • 1.0.58                                ...           3 years ago
  • 1.0.57                                ...           3 years ago
  • 1.0.56                                ...           3 years ago
  • 1.0.55                                ...           3 years ago
  • 1.0.54                                ...           3 years ago
  • 1.0.53                                ...           3 years ago
  • 1.0.52                                ...           3 years ago
  • 1.0.51                                ...           3 years ago
  • 1.0.50                                ...           3 years ago
  • 1.0.49                                ...           3 years ago
  • 1.0.48                                ...           3 years ago
  • 1.0.47                                ...           3 years ago
  • 1.0.46                                ...           3 years ago
  • 1.0.45                                ...           3 years ago
  • 1.0.44                                ...           3 years ago
  • 1.0.43                                ...           3 years ago
  • 1.0.42                                ...           3 years ago
  • 1.0.41                                ...           3 years ago
  • 1.0.40                                ...           3 years ago
  • 1.0.39                                ...           3 years ago
  • 1.0.38                                ...           3 years ago
  • 1.0.37                                ...           3 years ago
  • 1.0.36                                ...           3 years ago
  • 1.0.35                                ...           3 years ago
  • 1.0.34                                ...           3 years ago
  • 1.0.33                                ...           3 years ago
  • 1.0.32                                ...           3 years ago
  • 1.0.31                                ...           3 years ago
  • 1.0.30                                ...           3 years ago
  • 1.0.29                                ...           3 years ago
  • 1.0.28                                ...           3 years ago
  • 1.0.27                                ...           3 years ago
  • 1.0.26                                ...           3 years ago
  • 1.0.25                                ...           3 years ago
  • 1.0.24                                ...           3 years ago
  • 1.0.23                                ...           3 years ago
  • 1.0.22                                ...           3 years ago
  • 1.0.21                                ...           3 years ago
  • 1.0.20                                ...           3 years ago
  • 1.0.19                                ...           3 years ago
  • 1.0.18                                ...           3 years ago
  • 1.0.17                                ...           3 years ago
  • 1.0.16                                ...           3 years ago
  • 1.0.15                                ...           3 years ago
  • 1.0.14                                ...           3 years ago
  • 1.0.13                                ...           3 years ago
  • 1.0.12                                ...           3 years ago
  • 1.0.10                                ...           3 years ago
  • 1.0.9                                ...           3 years ago
  • 1.0.8                                ...           3 years ago
  • 1.0.7                                ...           3 years ago
  • 1.0.6                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (67)
Dev Dependencies (17)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |