|
2 | 2 |
|
3 | 3 | # js-data-firebase
|
4 | 4 |
|
5 |
| -[![Slack Status][sl_b]][sl_l] |
6 |
| -[![npm version][npm_b]][npm_l] |
7 |
| -[![Circle CI][circle_b]][circle_l] |
8 |
| -[![npm downloads][dn_b]][dn_l] |
9 |
| -[![Coverage Status][cov_b]][cov_l] |
10 |
| - |
11 |
| -Firebase adapter for [js-data](http://www.js-data.io/). |
12 |
| - |
13 |
| -To get started, visit __[http://js-data.io](http://www.js-data.io/docs/js-data-firebase)__. |
| 5 | +[![Slack][1]][2] |
| 6 | +[![NPM][3]][4] |
| 7 | +[![Tests][5]][6] |
| 8 | +[![Downloads][7]][8] |
| 9 | +[![Coverage][9]][10] |
14 | 10 |
|
15 | 11 | Tested on IE9, Chrome 46, Firefox 41 & Safari 7.1 using
|
16 | 12 | <img src="https://raw.githubusercontent.com/js-data/js-data-firebase/master/bs.jpg" alt="bs logo" title="browserstack" width="150" height="35" style="vertical-align: middle" />
|
17 | 13 |
|
18 |
| -## Links |
| 14 | +A Firebase adapter for the [JSData Node.js ORM][11]. |
| 15 | + |
| 16 | +### Installation |
| 17 | + |
| 18 | + npm install --save js-data js-data-firebase firebase |
| 19 | + |
| 20 | +### Usage (Browser) |
| 21 | + |
| 22 | +```js |
| 23 | +import { FirebaseAdapter } from 'js-data-firebase'; |
| 24 | + |
| 25 | +window.firebase.initializeApp({ |
| 26 | + apiKey: window.API_KEY, |
| 27 | + authDomain: window.AUTH_DOMAIN, |
| 28 | + databaseURL: window.DATABASE_URL |
| 29 | +}); |
| 30 | + |
| 31 | +// Create an instance of FirebaseAdapter |
| 32 | +const adapter = new FirebaseAdapter({ |
| 33 | + db: window.firebase.database() |
| 34 | +}); |
| 35 | + |
| 36 | +// Other JSData setup hidden |
| 37 | + |
| 38 | +// Register the adapter instance |
| 39 | +store.registerAdapter('firebase', adapter, { default: true }); |
| 40 | +``` |
| 41 | + |
| 42 | +### Usage (Node.js) |
| 43 | + |
| 44 | +```js |
| 45 | +import firebase from 'firebase'; |
| 46 | +import { FirebaseAdapter } from 'js-data-firebase'; |
| 47 | + |
| 48 | +firebase.initializeApp({ |
| 49 | + databaseURL: process.env.DATABASE_URL, |
| 50 | + serviceAccount: process.env.KEY_FILENAME || 'key.json' |
| 51 | +}); |
| 52 | + |
| 53 | +// Create an instance of FirebaseAdapter |
| 54 | +const adapter = new FirebaseAdapter({ |
| 55 | + db: firebase.database() |
| 56 | +}); |
| 57 | + |
| 58 | +// Other JSData setup hidden |
| 59 | + |
| 60 | +// Register the adapter instance |
| 61 | +store.registerAdapter('firebase', adapter, { default: true }); |
| 62 | +``` |
| 63 | + |
| 64 | +### JSData + Firebase Tutorial |
| 65 | + |
| 66 | +Start with the [JSData + Firebase tutorial][12] or checkout the [API Reference Documentation][13]. |
| 67 | + |
| 68 | +### Need help? |
| 69 | + |
| 70 | +Please [post a question][14] on Stack Overflow. **This is the preferred method.** |
| 71 | + |
| 72 | +You can also chat with folks on the [Slack Channel][15]. If you end up getting |
| 73 | +your question answered, please still consider consider posting your question to |
| 74 | +Stack Overflow (then possibly answering it yourself). Thanks! |
| 75 | + |
| 76 | +### Want to contribute? |
19 | 77 |
|
20 |
| -* [Quick start](http://www.js-data.io/docs/home#quick-start) - Get started in 5 minutes |
21 |
| -* [Guides and Tutorials](http://www.js-data.io/docs/home) - Learn how to use JSData |
22 |
| -* [`FirebaseAdapter` Guide](http://www.js-data.io/docs/js-data-firebase) - Learn how to use `FirebaseAdapter` |
23 |
| -* [API Reference Docs](http://api.js-data.io) - Explore components, methods, options, etc. |
24 |
| -* [Community & Support](http://js-data.io/docs/community) - Find solutions and chat with the community |
25 |
| -* [General Contributing Guide](http://js-data.io/docs/contributing) - Give back and move the project forward |
26 |
| - * [Contributing to js-data-firebase](https://github.com/js-data/js-data-firebase/blob/master/.github/CONTRIBUTING.md) |
| 78 | +Awesome! You can get started over at the [Contributing guide][16]. |
27 | 79 |
|
28 |
| -## License |
| 80 | +Thank you! |
29 | 81 |
|
30 |
| -The MIT License (MIT) |
| 82 | +### License |
31 | 83 |
|
32 |
| -Copyright (c) 2014-2016 js-data-firebase project authors |
| 84 | +[The MIT License (MIT)][17] |
33 | 85 |
|
34 |
| -* [LICENSE](https://github.com/js-data/js-data-firebase/blob/master/LICENSE) |
35 |
| -* [AUTHORS](https://github.com/js-data/js-data-firebase/blob/master/AUTHORS) |
36 |
| -* [CONTRIBUTORS](https://github.com/js-data/js-data-firebase/blob/master/CONTRIBUTORS) |
| 86 | +Copyright (c) 2014-2017 [js-data-firebase project authors][18] |
37 | 87 |
|
38 |
| -[sl_b]: http://slack.js-data.io/badge.svg |
39 |
| -[sl_l]: http://slack.js-data.io |
40 |
| -[npm_b]: https://img.shields.io/npm/v/js-data-firebase.svg?style=flat |
41 |
| -[npm_l]: https://www.npmjs.org/package/js-data-firebase |
42 |
| -[circle_b]: https://img.shields.io/circleci/project/js-data/js-data-firebase.svg?style=flat |
43 |
| -[circle_l]: https://circleci.com/gh/js-data/js-data-firebase |
44 |
| -[dn_b]: https://img.shields.io/npm/dm/js-data-firebase.svg?style=flat |
45 |
| -[dn_l]: https://www.npmjs.org/package/js-data-firebase |
46 |
| -[cov_b]: https://img.shields.io/codecov/c/github/js-data/js-data-firebase.svg?style=flat |
47 |
| -[cov_l]: https://codecov.io/github/js-data/js-data-firebase |
| 88 | +[1]: http://slack.js-data.io/badge.svg |
| 89 | +[2]: http://slack.js-data.io |
| 90 | +[3]: https://img.shields.io/npm/v/js-data-firebase.svg?style=flat |
| 91 | +[4]: https://www.npmjs.org/package/js-data-firebase |
| 92 | +[5]: https://img.shields.io/circleci/project/js-data/js-data-firebase.svg?style=flat |
| 93 | +[6]: https://circleci.com/gh/js-data/js-data-firebase |
| 94 | +[7]: https://img.shields.io/npm/dm/js-data-firebase.svg?style=flat |
| 95 | +[8]: https://www.npmjs.org/package/js-data-firebase |
| 96 | +[9]: https://img.shields.io/codecov/c/github/js-data/js-data-firebase.svg?style=flat |
| 97 | +[10]: https://codecov.io/github/js-data/js-data-firebase |
| 98 | +[11]: http://www.js-data.io/ |
| 99 | +[12]: http://www.js-data.io/docs/js-data-firebase |
| 100 | +[13]: http://api.js-data.io/js-data-firebase |
| 101 | +[14]: http://stackoverflow.com/questions/tagged/jsdata |
| 102 | +[15]: http://slack.js-data.io/ |
| 103 | +[16]: https://github.com/js-data/js-data-firebase/blob/master/.github/CONTRIBUTING.md |
| 104 | +[17]: https://github.com/js-data/js-data-firebase/blob/master/LICENSE |
| 105 | +[18]: https://github.com/js-data/js-data-firebase/blob/master/AUTHORS |
0 commit comments