https://github.com/arkemishub/clientjs
JS client for interacting with Arke backends
https://github.com/arkemishub/clientjs
arke client javascript
Last synced: about 1 year 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 (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-22T10:32:21.000Z (over 1 year ago)
- Last Synced: 2025-03-29T02:51:32.376Z (about 1 year ago)
- Topics: arke, client, javascript
- Language: TypeScript
- Homepage: https://client.arkehub.com
- Size: 1.21 MB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# @arkejs/client

[](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));
},
});
```