https://github.com/fleetbase/fleetbase-js
Fleetbase Javascript/ Node SDK
https://github.com/fleetbase/fleetbase-js
Last synced: about 1 year ago
JSON representation
Fleetbase Javascript/ Node SDK
- Host: GitHub
- URL: https://github.com/fleetbase/fleetbase-js
- Owner: fleetbase
- License: bsd-3-clause
- Created: 2019-03-22T10:30:24.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-03-27T08:25:46.000Z (about 2 years ago)
- Last Synced: 2024-09-30T07:09:35.430Z (over 1 year ago)
- Language: JavaScript
- Size: 9.43 MB
- Stars: 6
- Watchers: 6
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Fast, powerful, and easy to use JavaScript SDK for building on-demand and last-mile apps using Fleetbase API.
Build custom real-time on-demand experiences, and easily manage the flow from start to finish.
fleetbase.io | @fleetbase_io | Discord
## Installation
### With NPM
`npm install @fleetbase/sdk`
### With Yarn
`yarn add @fleetbase/sdk`
## Documentation
See the [documentation webpage](https://fleetbase.io/docs).
If you would like to make contributions to the Fleetbase Javascript SDK documentation source, here is a [guide](https://github.com/fleetbase/fleetbase-js/blob/master/CONTRIBUTING.md) in doing so.
## Quick Start for Browser
```js
import Fleetbase from '@fleetbase/sdk';
const fleetbase = new Fleetbase('Your Public Key');
// create a place
const speceNeedle = await fleetbase.places.create({
name: 'Space Needle',
street1: '400 Broad Street',
city: 'Seattle',
state: 'WA',
country: 'US',
});
```
## Quick Start for Node
```js
import Fleetbase from '@fleetbase/sdk';
const fleetbase = new Fleetbase('Your Secret Key');
// create a place
const speceNeedle = await fleetbase.places.create({
name: 'Space Needle',
street1: '400 Broad Street',
city: 'Seattle',
state: 'WA',
country: 'US',
});
```
## Create a custom adapter
You're able to create a custom adapter to handle network request in the Fleetbase SDK.
The Fleetbase SDK ships with two standard adapters. The BrowserAdapter which is based on `fetch()` and
the NodeAdapter based on axios.
```js
import { Adapter } from '@fleetbase/sdk';
class CustomAdapter extends Adapter {
constructor(config) {
super(config);
}
get() {}
post() {}
put() {}
patch() {}
delete() {}
}
```