{"id":19346449,"url":"https://github.com/canjs/canjs-feathers","last_synced_at":"2025-12-12T05:56:00.396Z","repository":{"id":15884126,"uuid":"18625275","full_name":"canjs/canjs-feathers","owner":"canjs","description":"CanJS model bindings for real-time updates from Feathers","archived":false,"fork":false,"pushed_at":"2020-05-14T04:45:42.000Z","size":236,"stargazers_count":21,"open_issues_count":18,"forks_count":5,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-10T11:40:22.169Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/canjs.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-10T05:38:31.000Z","updated_at":"2021-05-03T08:54:38.000Z","dependencies_parsed_at":"2022-08-04T07:00:13.787Z","dependency_job_id":null,"html_url":"https://github.com/canjs/canjs-feathers","commit_stats":null,"previous_names":["feathersjs/canjs-feathers"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canjs%2Fcanjs-feathers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canjs%2Fcanjs-feathers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canjs%2Fcanjs-feathers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canjs%2Fcanjs-feathers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/canjs","download_url":"https://codeload.github.com/canjs/canjs-feathers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223909971,"owners_count":17223592,"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-10T04:10:23.119Z","updated_at":"2025-12-12T05:56:00.344Z","avatar_url":"https://github.com/canjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# canjs-feathers\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/canjs/canjs-feathers.svg)](https://greenkeeper.io/)\n\n[![Build Status](https://travis-ci.org/feathersjs/canjs-feathers.png?branch=master)](https://travis-ci.org/feathersjs/canjs-feathers)\n\nA set of utils for using CanJS with Feathers client.\n\n***[can-connect-feathers](https://github.com/canjs/can-connect-feathers) is the better option for connecting your CanJS application to Feathers.***\n\n## Installation\n```\nnpm install canjs-feathers --save\n```\n\n## Documentation\nPlease refer to the [Feathers + CanJS](http://docs.feathersjs.com/frameworks/canjs.html) page in the official Feathers docs.\n\n\u003e Note: The 1.0.0 version of `canjs-feathers` is only compatible with CanJS 3.0 and DefineMaps (the can-define plugin).\n\n## Complete Example\nHere's an example of setting up a feathers connection and Account Model for your CanJS application.\n```js\nimport feathers from 'feathers/client';\nimport socketio from 'feathers-socketio/client';\nimport hooks from 'feathers-hooks';\nimport io from 'socket.io-client';\nimport rxjs from 'rxjs';\nimport rx from 'feathers-reactive';\n\nconst host = 'http://localhost:3030';\nconst socket = io(host, {\n  transports: ['websocket'],\n  forceReconnect: true\n});\nconst app = feathers()\n\t// Use the feathers-reactive plugin for live-updating lists!\n  .configure(rx(rxjs, {\n    idField: '_id'\n  }))\n  .configure(hooks())\n  .configure(socketio(socket));\n\n// Model creation would usually go in its own file,\n// but here it is inline for simplicity.\nimport DefineMap from 'can-define/map/';\nimport DefineList from 'can-define/list/';\nimport Connection from 'canjs-feathers';\n\n// Define a Robot Model.\nconst Robot = DefineMap.extend('Robot', {\n\tseal: false\n}, {\n\t'_id': '*',\n\tmodel: {type: 'string'}\n});\n\n// Define a Robot.List.\nRobot.List = DefineList.extend({\n\t'*': Robot\n});\n\n// Combine the best of both CanJS and Feathers.\nnew Connection({\n\tservice: app.service('v1/robots'),\n\tidProp: '_id',\n\tMap: Robot\n});\n\n// You can now use `find` directly from the Robot model.\nRobot.find({model: 'T1000'}).then(response =\u003e {\n\t// The returned data will be a List (Observable array) of Robot instances.\n\tconsole.log(response);\n});\n\n// Using the service directly will also return Robot instances.\napp.service('v1/robots').find({}).then(response =\u003e {\n\tconsole.log(response); // --\u003e Robot instances!\n});\n```\n\n## Usage\n\n### ES6 use\n\nWith StealJS, you can import this module directly in a template that is autorendered:\n\n```js\nimport plugin from 'canjs-feathers';\n```\n\n### CommonJS use\n\nUse `require` to load `canjs-feathers` and everything else\nneeded to create a template that uses `canjs-feathers`:\n\n```js\nvar plugin = require(\"canjs-feathers\");\n```\n\n## AMD use\n\nConfigure the `can` and `jquery` paths and the `canjs-feathers` package:\n\n```html\n\u003cscript src=\"require.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n\trequire.config({\n\t    paths: {\n\t        \"jquery\": \"node_modules/jquery/dist/jquery\",\n\t        \"can\": \"node_modules/canjs/dist/amd/can\"\n\t    },\n\t    packages: [{\n\t\t    \tname: 'canjs-feathers',\n\t\t    \tlocation: 'node_modules/canjs-feathers/dist/amd',\n\t\t    \tmain: 'lib/canjs-feathers'\n\t    }]\n\t});\n\trequire([\"main-amd\"], function(){});\n\u003c/script\u003e\n```\n\n### Standalone use\n\nLoad the `global` version of the plugin:\n\n```html\n\u003cscript src='./node_modules/canjs-feathers/dist/global/canjs-feathers.js'\u003e\u003c/script\u003e\n```\n\n## Contributing\n\n### Making a Build\n\nTo make a build of the distributables into `dist/` in the cloned repository run\n\n```\nnpm install\nnode build\n```\n\n### Running the tests\n\nTests can run in the browser by opening a webserver and visiting the `test.html` page.\nAutomated tests that run the tests from the command line in Firefox can be run with\n\n```\nnpm test\n```\n\n## License\n\nCopyright (c) 2016, FeathersJS\n\nLicensed under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanjs%2Fcanjs-feathers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcanjs%2Fcanjs-feathers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanjs%2Fcanjs-feathers/lists"}