4bnode 1.0.3 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -35
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,106 +1,116 @@
|
|
|
1
|
-
# 4Brains Node
|
|
1
|
+
# 4Brains Node Tool
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A professional tool to streamline the generation and management of Node.js applications by 4Brains Technologies.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Usage via NPX
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
No global installation needed.
|
|
8
|
+
|
|
9
|
+
Run any command using `npx`:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npx 4bnode <command>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Examples:
|
|
8
16
|
|
|
9
17
|
```sh
|
|
10
|
-
|
|
18
|
+
npx 4bnode init my-project
|
|
19
|
+
npx 4bnode add-mongo
|
|
20
|
+
npx 4bnode add-serialport
|
|
11
21
|
```
|
|
12
22
|
|
|
13
23
|
## Available Commands
|
|
14
24
|
|
|
15
|
-
### `4bnode init <projectName>`
|
|
25
|
+
### `npx 4bnode init <projectName>`
|
|
16
26
|
|
|
17
27
|
Initialize a new Node.js project with the specified name.
|
|
18
28
|
|
|
19
29
|
```sh
|
|
20
|
-
4bnode init my-project
|
|
30
|
+
npx 4bnode init my-project
|
|
21
31
|
```
|
|
22
32
|
|
|
23
|
-
### `4bnode add-api <endpointName>`
|
|
33
|
+
### `npx 4bnode add-api <endpointName>`
|
|
24
34
|
|
|
25
35
|
Add a new API endpoint to your project.
|
|
26
36
|
|
|
27
37
|
```sh
|
|
28
|
-
4bnode add-api users
|
|
38
|
+
npx 4bnode add-api users
|
|
29
39
|
```
|
|
30
40
|
|
|
31
|
-
### `4bnode add-mongo`
|
|
41
|
+
### `npx 4bnode add-mongo`
|
|
32
42
|
|
|
33
43
|
Integrate MongoDB into your project. This command sets up the necessary MongoDB configuration.
|
|
34
44
|
|
|
35
45
|
```sh
|
|
36
|
-
4bnode add-mongo
|
|
46
|
+
npx 4bnode add-mongo
|
|
37
47
|
```
|
|
38
48
|
|
|
39
|
-
### `4bnode add-mongo-schema <schemaName>`
|
|
49
|
+
### `npx 4bnode add-mongo-schema <schemaName>`
|
|
40
50
|
|
|
41
51
|
Create a new MongoDB schema. You will be prompted to enter field details for the schema.
|
|
42
52
|
|
|
43
53
|
```sh
|
|
44
|
-
4bnode add-mongo-schema User
|
|
54
|
+
npx 4bnode add-mongo-schema User
|
|
45
55
|
```
|
|
46
56
|
|
|
47
|
-
### `4bnode add-login`
|
|
57
|
+
### `npx 4bnode add-login`
|
|
48
58
|
|
|
49
59
|
Add a login template to an existing route in your project. You will be prompted to select a route and a model, and then enter the login fields.
|
|
50
60
|
|
|
51
61
|
```sh
|
|
52
|
-
4bnode add-login
|
|
62
|
+
npx 4bnode add-login
|
|
53
63
|
```
|
|
54
64
|
|
|
55
|
-
### `4bnode add-mongo-insert`
|
|
65
|
+
### `npx 4bnode add-mongo-insert`
|
|
56
66
|
|
|
57
67
|
Add a template for inserting data into a MongoDB collection. This command allows you to easily create routes for data insertion.
|
|
58
68
|
|
|
59
69
|
```sh
|
|
60
|
-
4bnode add-mongo-insert
|
|
70
|
+
npx 4bnode add-mongo-insert
|
|
61
71
|
```
|
|
62
72
|
|
|
63
|
-
### `4bnode add-mongo-update`
|
|
73
|
+
### `npx 4bnode add-mongo-update`
|
|
64
74
|
|
|
65
75
|
Add a template for updating data in a MongoDB collection. This facilitates creating routes for updating documents.
|
|
66
76
|
|
|
67
77
|
```sh
|
|
68
|
-
4bnode add-mongo-update
|
|
78
|
+
npx 4bnode add-mongo-update
|
|
69
79
|
```
|
|
70
80
|
|
|
71
|
-
### `4bnode add-mongo-read`
|
|
81
|
+
### `npx 4bnode add-mongo-read`
|
|
72
82
|
|
|
73
83
|
Add a template for reading data from a MongoDB collection, helping you to quickly set up read operations.
|
|
74
84
|
|
|
75
85
|
```sh
|
|
76
|
-
4bnode add-mongo-read
|
|
86
|
+
npx 4bnode add-mongo-read
|
|
77
87
|
```
|
|
78
88
|
|
|
79
|
-
### `4bnode add-mongo-delete`
|
|
89
|
+
### `npx 4bnode add-mongo-delete`
|
|
80
90
|
|
|
81
91
|
Add a template for deleting data from a MongoDB collection, making it easy to handle deletion operations.
|
|
82
92
|
|
|
83
93
|
```sh
|
|
84
|
-
4bnode add-mongo-delete
|
|
94
|
+
npx 4bnode add-mongo-delete
|
|
85
95
|
```
|
|
86
96
|
|
|
87
|
-
### `4bnode add-socket`
|
|
97
|
+
### `npx 4bnode add-socket`
|
|
88
98
|
|
|
89
99
|
Integrate Socket.io into your project for real-time communication capabilities.
|
|
90
100
|
|
|
91
101
|
```sh
|
|
92
|
-
4bnode add-socket
|
|
102
|
+
npx 4bnode add-socket
|
|
93
103
|
```
|
|
94
104
|
|
|
95
|
-
### `4bnode add-websocket`
|
|
105
|
+
### `npx 4bnode add-websocket`
|
|
96
106
|
|
|
97
107
|
Add native WebSocket support to your project.
|
|
98
108
|
|
|
99
109
|
```sh
|
|
100
|
-
4bnode add-websocket
|
|
110
|
+
npx 4bnode add-websocket
|
|
101
111
|
```
|
|
102
112
|
|
|
103
|
-
### `4bnode add-serialport`
|
|
113
|
+
### `npx 4bnode add-serialport`
|
|
104
114
|
|
|
105
115
|
Integrate SerialPort functionality into your project. This command does the following:
|
|
106
116
|
|
|
@@ -110,7 +120,7 @@ Integrate SerialPort functionality into your project. This command does the foll
|
|
|
110
120
|
- Installs required dependencies: `serialport` and `@serialport/parser-readline`
|
|
111
121
|
|
|
112
122
|
```sh
|
|
113
|
-
4bnode add-serialport
|
|
123
|
+
npx 4bnode add-serialport
|
|
114
124
|
```
|
|
115
125
|
|
|
116
126
|
Once added, your project will automatically initialize the serial port with the specified configuration and log incoming data.
|
|
@@ -128,7 +138,7 @@ Received data: <data from serial device>
|
|
|
128
138
|
When you run the command to add a MongoDB schema, you will be prompted to enter the field details.
|
|
129
139
|
|
|
130
140
|
```sh
|
|
131
|
-
4bnode add-mongo-schema User
|
|
141
|
+
npx 4bnode add-mongo-schema User
|
|
132
142
|
```
|
|
133
143
|
|
|
134
144
|
### Adding a Login Template
|
|
@@ -136,7 +146,7 @@ When you run the command to add a MongoDB schema, you will be prompted to enter
|
|
|
136
146
|
When you run the command to add a login template, you will be prompted to select a route and a model, and then enter the login fields.
|
|
137
147
|
|
|
138
148
|
```sh
|
|
139
|
-
4bnode add-login
|
|
149
|
+
npx 4bnode add-login
|
|
140
150
|
```
|
|
141
151
|
|
|
142
152
|
## Real-time Communication Integration
|
|
@@ -146,7 +156,7 @@ When you run the command to add a login template, you will be prompted to select
|
|
|
146
156
|
When you add WebSocket integration, it will automatically be added to your project.
|
|
147
157
|
|
|
148
158
|
```sh
|
|
149
|
-
4bnode add-websocket
|
|
159
|
+
npx 4bnode add-websocket
|
|
150
160
|
```
|
|
151
161
|
|
|
152
162
|
To use `req.wss` in your route endpoints, you can access the WebSocket server as follows:
|
|
@@ -167,7 +177,7 @@ router.get("/some-endpoint", (req, res) => {
|
|
|
167
177
|
When you add Socket.io integration, it will automatically be added to your project.
|
|
168
178
|
|
|
169
179
|
```sh
|
|
170
|
-
4bnode add-socket
|
|
180
|
+
npx 4bnode add-socket
|
|
171
181
|
```
|
|
172
182
|
|
|
173
183
|
To use `req.io` in your route endpoints, you can access the Socket.io server as follows:
|
|
@@ -190,8 +200,8 @@ Unknown command. Use -h or --help for help.
|
|
|
190
200
|
You can also use `-h` or `--help` to get help information.
|
|
191
201
|
|
|
192
202
|
```sh
|
|
193
|
-
4bnode -h
|
|
194
|
-
4bnode --help
|
|
203
|
+
npx 4bnode -h
|
|
204
|
+
npx 4bnode --help
|
|
195
205
|
```
|
|
196
206
|
|
|
197
207
|
## License
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "4bnode",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "A
|
|
3
|
+
"version": "1.0.6",
|
|
4
|
+
"description": "A professional tool to generate a Node.js app by 4Brains Technologies",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|