Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arkemishub/clientjs
JS client for interacting with Arke backends
https://github.com/arkemishub/clientjs
arke client javascript
Last synced: 13 days ago
JSON representation
JS client for interacting with Arke backends
- Host: GitHub
- URL: https://github.com/arkemishub/clientjs
- Owner: arkemishub
- License: apache-2.0
- Created: 2023-05-12T09:19:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-27T10:32:00.000Z (6 months ago)
- Last Synced: 2024-06-27T15:18:30.920Z (6 months ago)
- Topics: arke, client, javascript
- Language: TypeScript
- Homepage: https://client.arkehub.com
- Size: 1.17 MB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# @arkejs/client
![Client](https://github.com/arkemishub/clientjs/assets/81776297/cf43c6aa-e219-48e3-9c7c-eb4e1ff56225)
[![License](https://img.shields.io/badge/license-Apache2.0-blue.svg)](https://github.com/arkemishub/arke-monorepo/blob/master/LICENSE.txt)
An isomorphic JavaScript client for Arke backend connection
## Usage
First of all, you need to install the library:
```shell
npm install @arkejs/client
pnpm install @arkejs/client
```Then you're able to import the library and establish the connection with the database:
```tsx
import Client from '@arkejs/client'// Create a single arke js for interacting with your server
const client = new Client({
serverUrl: 'http://localhost:4000',
project: 'PROJECT_NAME',
})client.arke.get('my_arke').then(
res => console.log(res.data),
err => console.error(err.response.data)
)
```When you initialize the client you can define custom methods to get the Auth session:
```tsx
const client = new Client({
serverUrl: 'http://localhost:4000',
project: 'PROJECT_NAME',
getSession: async () => {
const session = await AsyncStorage.getItem('@session');
return session;
},
setSession: async session => {
await AsyncStorage.setItem('@session', JSON.stringify(session.content));
},
});
```