You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ A simple json dbms with an orm, for nodejs, compatible with js and ts.
3
3
___
4
4
5
5
```bash
6
-
npm install -g json-base
6
+
npm install @ndzhwr/json-base
7
7
```
8
8
9
9
<br></br>
@@ -18,15 +18,15 @@ To get started, first make sure you have the latest stable version of nodejs on
18
18
19
19
You have to install jsondb with npm, it's not currently available on other package managers like yarn, etc.
20
20
```bash
21
-
$ npm install -g json-base
21
+
$ npm install @ndzhwr/json-base
22
22
```
23
23
24
24
**2. Initialize jsondb in your project**
25
25
26
26
Initialize jsondb in your project. Open the root folder of your project in your terminal and initialize json-base. This will create a `database.json` file in the project.
27
27
28
28
```bash
29
-
$ json-base --init
29
+
$ npx json-base --init
30
30
```
31
31
32
32
**3. Create your base schema or just leave it.**
@@ -53,7 +53,7 @@ Let's have a simple tutorial on how we can use this `json-base`. We're going to
53
53
Before starting to perform transactions to the database, let's
54
54
learn a little bit on the usage of the CLI
55
55
```
56
-
Usage : json-base [command]
56
+
Usage : npx json-base [command]
57
57
Commands :
58
58
--init Initialized the database.json in the current directory
59
59
--version Prints the current version of json-base
@@ -92,7 +92,7 @@ You will need to remove the models in the json database as long as the sample on
92
92
#### 2. Getting data
93
93
In this section, we're going to see how we can get data from our json database.
94
94
```ts
95
-
import { get } from'json-base'
95
+
import { get } from'@ndzhwr/json-base'
96
96
(asyncfunction(){
97
97
const aUsersWithId2 =awaitget({
98
98
collection : "users",
@@ -108,7 +108,7 @@ The code above retreives `1 record` from the `users` collection, where `user.id
108
108
#### 3. Create data
109
109
As said before, we'll be creating a simple crud operation, this means that we already have read checked on our todo checklist as read is the same as getting data. Next we're going to work on creating data.
110
110
```ts
111
-
import { add } from'json-base'
111
+
import { add } from'@ndzhwr/json-base'
112
112
(asyncfunction(){
113
113
awaitadd({
114
114
collection : "posts",
@@ -129,7 +129,7 @@ Let's combine the update and the delete sections into one section as long as t
129
129
130
130
Updating data will require a unique identifier of the record we're updating.
131
131
```ts
132
-
import { set } from'json-base'
132
+
import { set } from'@ndzhwr/json-base'
133
133
awaitset({
134
134
collection : "users",
135
135
where : {
@@ -144,7 +144,7 @@ Updating data will require a unique identifier of the record we're updating.
144
144
Enough for updating data, the next is to learn how to delete some records from the json database. Here, a unique identifier is required.
145
145
146
146
```ts
147
-
import { del } from'json-base'
147
+
import { del } from'@ndzhwr/json-base'
148
148
149
149
(asyncfunction(){
150
150
awaitdel({
@@ -156,7 +156,7 @@ Enough for updating data, the next is to learn how to delete some records from t
156
156
}())
157
157
```
158
158
159
-
π Congrats! Now we've finished creating our CRUD operations on the users model or collection and I hope now you're able to consume our API and make your life easier.
159
+
π Congrats! Now we've finished creating our CRUD operations on the models and I hope now you're able to consume the API and make your life easier.
160
160
*For more, jsdoc was used , hover on your imported function to see the documentation*
0 commit comments