Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
service:jsondb [2022/11/28 18:08] – [Best Practices] Updated the lock/unlock example Nightfox | service:jsondb [2022/11/28 22:18] – Fixed links to other pages on the wiki Nightfox | ||
---|---|---|---|
Line 4: | Line 4: | ||
\\ | \\ | ||
===== Updating services.ini and json-service.ini ===== | ===== Updating services.ini and json-service.ini ===== | ||
- | Synchronet provides this via the script json-service.js (in the exec directory). | + | Synchronet provides this via the script json-service.js (in the exec directory). |
< | < | ||
[JSON] | [JSON] | ||
Line 13: | Line 13: | ||
Note the port number is 10088. | Note the port number is 10088. | ||
\\ | \\ | ||
- | For storing data to be accessed this way, Synchronet uses the concept of JSON " | + | For storing data to be accessed this way, Synchronet uses the concept of JSON " |
< | < | ||
[oneliners] | [oneliners] | ||
Line 23: | Line 23: | ||
===== Reading from & writing to a JSON database===== | ===== Reading from & writing to a JSON database===== | ||
- | Most basically, all that is really required to interact with a JSON database is writing (adding/ | + | In a JavaScript mod/ |
+ | require(" | ||
+ | Then, create a JSONClient object. | ||
+ | var jsonClient = new JSONClient(" | ||
+ | Most basically, all that is really required to interact with a JSON database is writing (adding/ | ||
jsonClient.read(scope, | jsonClient.read(scope, | ||
Line 52: | Line 56: | ||
{ | { | ||
} | } | ||
+ | |||
+ | Also, when you are done using your JSONClient object, it is generally a good practice to explicitly have it disconnect from the server, by calling the ' | ||
+ | jsonClient.disconnect(); | ||
===== Best Practices ===== | ===== Best Practices ===== |