Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
68 additions
and
12 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
extra_docs/examples/javascript/node/rest_get_all_records.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// tslint:disable:no-console | ||
// tslint:disable:interface-name | ||
// Node application | ||
import { dataOperations, jexiaClient } from "jexia-sdk-js/node"; | ||
|
||
// Optionally use interfaces to type your datasets, | ||
// then you will have better auto complete and type cheeking | ||
interface Post { | ||
title: string; | ||
published: boolean; | ||
} | ||
|
||
// Initialize DataOperationsModule | ||
let dom = dataOperations(); | ||
|
||
// Initialize Client and pass DataOperationsModule to it. | ||
jexiaClient().init({ | ||
projectID: "_projectId_", | ||
key: "_key_", | ||
secret: "_secret_" | ||
}, dom); | ||
|
||
// Use your data module with an optional generic type | ||
dom.dataset<Post>("posts") | ||
.select() | ||
// .fields("title", "id", "created_at") | ||
.execute() | ||
.then((records) => { | ||
console.log(records); | ||
process.exit(); | ||
}) | ||
.catch((error) => { | ||
// there was a problem retrieving the records | ||
console.log(error); | ||
process.exit(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters