From source:
npm i && npm run build && npm start
Via Docker:
docker run --rm -d -p 80:1234 -e PORT=1234 ghcr.io/cloud-cli/json-store:latest
import { Store } from 'https://server-address.io/index.mjs';
// create a store (first time)
const storeId = await Store.create();
// -- later --
// consume a store
const store = Store.get('__your_store_id__');
const users = await store.getResource('users');
// add resource
await users.add({ uid: '123', name: 'Joe' });
// remove it
await users.remove('123');
// get one
await users.get('123');
// list all
await users.list();
Create a database:
curl 'https://server-address.io/new'
{
"id": "cdc0cafc15b857a2a61d292c0a30359091f57c9bc430f0785d0ed564f0b1fb9b"
}
The following command will create a user in /user/123
:
curl -XPOST -H "Content-type: application/json" -d '{ "name": "John Doe" }' 'https://server-address.io/cdc0cafc15b857a2a61d292c0a30359091f57c9bc430f0785d0ed564f0b1fb9b/user/123'
The following command will retrieve the user we created earlier:
curl 'https://server-address.io/cdc0cafc15b857a2a61d292c0a30359091f57c9bc430f0785d0ed564f0b1fb9b/user/123'
The following command will delete the user:
curl -X DELETE 'https://server-address.io/cdc0cafc15b857a2a61d292c0a30359091f57c9bc430f0785d0ed564f0b1fb9b/user/123'
Variable | Description |
---|---|
PORT | http port where the service runs |
STORAGE | Type of storage to use. "memory", "file", "sqlite" |
FILE_PATH | /path/to/folder where files will be stored if 'file' storage is used |
SQLITE_PATH | Path to db file if 'sqlite' storage is used |
DEBUG | Set to any truthy value to enable debug logging |