Skip to content

Commit fc9600e

Browse files
committed
moar docs
1 parent 7a72b6a commit fc9600e

4 files changed

Lines changed: 84 additions & 7 deletions

File tree

README.md

Lines changed: 77 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,87 @@
11
# @dataparty/api
22
[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)[![license](https://img.shields.io/github/license/datapartyjs/api)](https://github.com/datapartyjs/dataparty-api/blob/master/LICENSE)
33

4-
@dataparty/api is an ad-hoc cloud solution for the Web3.0 generation.
4+
ad-hoc cloud for the Web3.0 generation
55

66
* Documentation - [datapartyjs.github.io/dataparty-api](https://datapartyjs.github.io/dataparty-api)
77
* NPM - [npmjs.com/package/@dataparty/api](https://www.npmjs.com/package/@dataparty/api)
88
* Code - [github.com/datapartyjs/dataparty-api](https://github.com/datapartyjs/dataparty-api)
99
* Support - [ko-fi/dataparty](https://ko-fi.com/dataparty)
1010

11-
# Goals
11+
## Goals
1212

13-
The primary goal of @dataparty/api is to push
13+
The primary goal of `@dataparty/api` is to enable secure microservices development across all architectual domains with a single code base. This covers traditional clouds, peer-to-peer apps(with or without cloud backing), and hybrid clouds.
14+
15+
16+
17+
## Roadmap
18+
19+
Currently this project is considered `Experimental`, throughout 2023 we'll be working towards our first stable releases.
20+
21+
![Feature Roadmap 2023](images/dataparty-overivew-full.svg)
22+
23+
24+
25+
## Example
26+
27+
```
28+
29+
const Dataparty = require('@dataparty/api')
30+
31+
32+
async function getUser(name) {
33+
return (await local.find()
34+
.type('user')
35+
.where('name').equals(name)
36+
.exec())[0]
37+
}
38+
39+
40+
async function main(){
41+
const dbPath = (await fs.mkdtemp('/tmp/loki-party')) + '/loki.db'
42+
43+
debug('db location', dbPath)
44+
45+
local = new Dataparty.LokiParty({
46+
path: dbPath,
47+
model: MyServiceModel,
48+
config: new Dataparty.Config.MemoryConfig()
49+
})
50+
51+
52+
await local.start()
53+
54+
let user = await getUser('tester')
55+
56+
57+
if(!user){
58+
debug('creating document')
59+
user = await local.createDocument('user', {name: 'tester', created: (new Date()).toISOString() })
60+
}
61+
else{
62+
debug('loaded document')
63+
}
64+
65+
console.log(user.data)
66+
67+
68+
user.data.name = 'renamed-tester'
69+
70+
await user.save()
71+
72+
console.log(user.data)
73+
74+
let userFind = await getUser('renamed-tester')
75+
76+
console.log(userFind)
77+
78+
79+
console.log(dbPath)
80+
81+
82+
await user.remove()
83+
84+
console.log(await getUser('renamed-tester'))
85+
86+
}
87+
```

images/dataparty-overivew-full.svg

Lines changed: 1 addition & 0 deletions
Loading

src/config/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ const JsonFileConfig = require('./json-file')
44
const LocalStorageConfig = require('./local-storage')
55

66
/**
7-
* Config
8-
* @namespace Config
7+
* @module Config
98
*/
109
const Config = {
1110
NconfConfig,

src/config/json-file.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ const logger = require('debug')('dataparty.config.json-file')
1010
const IConfig = require('./iconfig')
1111

1212
/**
13-
* @class Config.JsonFileConfig
13+
* @module Config
14+
*/
15+
16+
/**
17+
* @class
1418
* @implements {IConfig}
15-
* @namespace Config
1619
*/
1720
class JsonFileConfig extends IConfig {
1821

0 commit comments

Comments
 (0)