From 88a5ecf0dc6e1bd829019d5a42a946dcec03f68b Mon Sep 17 00:00:00 2001
From: Neferett <30388371+jordanbonaldi@users.noreply.github.com>
Date: Tue, 26 May 2020 19:09:38 +0200
Subject: [PATCH] Create README.md
---
README.md | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 91 insertions(+)
create mode 100644 README.md
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..77aefaa
--- /dev/null
+++ b/README.md
@@ -0,0 +1,91 @@
+
+
+# RedisAPI NodeJS
+
+
+
+
+
+
+
+
+
+## Installation
+
+`npm install @neferett/nedis`
+
+```typescript
+ new RedisDatabase(, ).connect()
+```
+
+## How to use it
+
+First you have to create a Model class extending the abstract RedisModel as follow:
+ ```typescript
+ export interface CategoryInterface {
+ assets : string[],
+ messageID : string,
+ name ?: string
+}
+
+export default new class CategoryModel extends RedisModel {
+ constructor() {
+ // First arguments is the database number
+ // Second arguments is the folder folder name
+ super(2, 'categories');
+ }
+}
+```
+
+Once your model is created and your database connected you can do as follow:
+```typescript
+ CategoryModel.create('6', {
+ assets: ["BTCUSD"],
+ messageID: "189027633",
+ name: "Bitcoin"
+});
+
+CategoryModel.read('6').then((category: CategoryInterface) => {});
+
+CategoryModel.update('6', {
+ assets: ["BTCUSD", "ETHUSD"],
+ messageID: "189027633",
+ name: "Bitcoin"
+}).then((category: CategoryInterface) => {});
+
+CategoryModel.getAll().then((categories: {value: string, data: CategoryInterface}[]) => {
+ // Do whatever you want
+});
+
+CategoryModel.delete('6');
+
+CategoryModel.read('6').then((category: CategoryInterface) =>
+ CategoryModel.update('6', {
+ ...category,
+ assets: ["ETHUSD"]
+ }));
+```
+
+## Models Methods
+
+```typescript
+/* Data ID to create with the interface/class to push */
+create(id: string, data: T): Promise;
+
+/* Data ID to read and return in promise */
+read(id: string): Promise;
+
+/* Data ID and new Data to push */
+update(id: string, data: T): Promise;
+
+/* Data ID to delete*/
+delete(id: string): Promise;
+
+/* All Data inside Models to return */
+getAll(): Promise<{value: string, data: T[]}[]>;
+
+```
+
+## License
+
+Licensed under MIT