Setup#

The Rebased core is composed of the foundation necessary so that other pieces can fit together. It also ships the http driver which is used for fetching data as default. Rebased also provides another drivers so you can easy switch data source without refactoring the whole code. In case you need to connect with other drivers you can just install packages like firebase and parse or even create your own.

Install#

npm install @rebased/core

Configure#

import { install } from '@rebased/core';
install({
silent: true, // disable logs
driver: 'firestore', // default driver
timestampCreated: 'createdAt',
timestampUpdated: 'updatedAt',
identifier: 'objectId' // auto generated id
});

Example#

// Get a random kitty
fetch('kitty', {
silent: false, // show logs
baseURL: 'https://api.thecatapi.com',
endpoint: '/v1'
})
.from('http') // use http driver
.get('/images/search?size=small&mime_types=gif')
.subscribe(
kitty => console.log(kitty),
err => console.log(err)
);