{"id":19195290,"url":"https://github.com/fixate/redux-resx-feathers-middleware","last_synced_at":"2025-06-18T01:40:49.807Z","repository":{"id":57351398,"uuid":"85189188","full_name":"fixate/redux-resx-feathers-middleware","owner":"fixate","description":"Feathers middleware for redux-resx","archived":false,"fork":false,"pushed_at":"2017-10-23T17:28:57.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-24T05:47:53.209Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fixate.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-16T11:38:47.000Z","updated_at":"2017-09-20T18:48:48.000Z","dependencies_parsed_at":"2022-08-31T06:22:01.267Z","dependency_job_id":null,"html_url":"https://github.com/fixate/redux-resx-feathers-middleware","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixate%2Fredux-resx-feathers-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixate%2Fredux-resx-feathers-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixate%2Fredux-resx-feathers-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixate%2Fredux-resx-feathers-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fixate","download_url":"https://codeload.github.com/fixate/redux-resx-feathers-middleware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240271526,"owners_count":19774859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T12:09:32.883Z","updated_at":"2025-02-23T04:39:04.047Z","avatar_url":"https://github.com/fixate.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redux-resx-feathers-middleware\n\nMiddleware for [redux-resx](https://github.com/fixate/redux-resx) using\n`feathers-client`.\n\n```shell\nnpm install --save redux-resx-feathers-middleware\n```\n\n## Usage\n\n```javascript\nimport resxMiddleware from 'redux-resx-feathers-middleware';\n\nimport feathers from 'feathers-client';\nimport rest from 'feathers-client/rest';\n\nimport reducers from './reducers';\n\n// Setup your feathers app - probably in a different file\nconst app = feathers().configure(rest('/api').fetch(fetch));\n\nexport default function createAppStore() {\n  return createStore(\n    reducers,\n    compose(\n      applyMiddleware(\n        resxMiddleware(app)\n      ),\n      window.devToolsExtension ? window.devToolsExtension() : (f) =\u003e f\n    )\n  );\n}\n```\n\n## Websocket support\n\nNot yet - all we'd need to add is websocket events handlers that fire receiver actions\n\n## Pagination (v0.1.0)\n\n**WARNING: This API may change. I'd like feedback on it :)**\n\nPagination is handled by installing a `resultReducer` on your resource.\n\n```javascript\nimport pagination from 'redux-resx-feathers-middleware';\n\nconst paginate = pagination({ perPage: 10 });\nexport const users = createResource({\n  name: '@resx/USER',\n  url: '/users',\n  // Add this to paginated endpoints\n  resultReducers: {\n    find: paginate,\n  },\n});\n```\n\nThis will add a `pagination` object to your resource state:\n\nHere is an exmaple when using it in a component:\n\n```javascript\nimport React, { PropTypes } from 'react';\nimport { bindActionCreators } from 'redux';\nimport { connect } from 'react-redux';\n\nimport { users } from '../../resources';\n\nexport const UsersPage = React.createClass({\n  displayName: 'UsersPage',\n\n  propTypes: {\n    findUsers: PropTypes.func.isRequired,\n    dispatch: PropTypes.func.isRequired,\n    users: PropTypes.object.isRequired,\n  },\n\n  componentWillMount() {\n    const { findUsers } = this.props;\n    findUsers({ query: { roles: 'admin' } });\n  },\n\n  render() {\n    const { users: { items, pagination }, dispatch } = this.props;\n\n    // *** Important bit here **\n    // Dispatch pagination.next to fetch the next items.\n    // The result of this call will be concatenated onto items.\n    const next = () =\u003e dispatch(pagination.next);\n    return (\n      \u003cdiv\u003e\n        \u003ch1\u003eEmails:\u003c/h1\u003e\n        {JSON.stringify(items.map(i =\u003e i.email))}\n        {pagination ? \u003cbutton disabled={!pagination.hasMore} onClick={next}\u003eNext\u003c/button\u003e : null}\n      \u003c/div\u003e\n    );\n  },\n});\n\nfunction mapStateToProps(state) {\n  return {\n    users: users.selector(state),\n  };\n}\n\nconst { find: findUsers } = users.actions;\n\nexport default connect(mapStateToProps, {\n  findUsers,\n})(UsersPage);\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffixate%2Fredux-resx-feathers-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffixate%2Fredux-resx-feathers-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffixate%2Fredux-resx-feathers-middleware/lists"}