4bnode 1.0.3 → 1.0.5
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 +54 -110
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,121 +1,81 @@
|
|
|
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
8
|
|
|
9
|
-
|
|
10
|
-
npm install -g 4bnode
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Available Commands
|
|
14
|
-
|
|
15
|
-
### `4bnode init <projectName>`
|
|
16
|
-
|
|
17
|
-
Initialize a new Node.js project with the specified name.
|
|
9
|
+
Run any command using `npx`:
|
|
18
10
|
|
|
19
11
|
```sh
|
|
20
|
-
4bnode
|
|
12
|
+
npx 4bnode <command>
|
|
21
13
|
```
|
|
22
14
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Add a new API endpoint to your project.
|
|
15
|
+
Examples:
|
|
26
16
|
|
|
27
17
|
```sh
|
|
28
|
-
4bnode
|
|
18
|
+
npx 4bnode init my-project
|
|
19
|
+
npx 4bnode add-mongo
|
|
20
|
+
npx 4bnode add-serialport
|
|
29
21
|
```
|
|
30
22
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Integrate MongoDB into your project. This command sets up the necessary MongoDB configuration.
|
|
23
|
+
## Available Commands
|
|
34
24
|
|
|
35
|
-
|
|
36
|
-
4bnode add-mongo
|
|
37
|
-
```
|
|
25
|
+
### `npx 4bnode init <projectName>`
|
|
38
26
|
|
|
39
|
-
|
|
27
|
+
Initialize a new Node.js project with the specified name.
|
|
40
28
|
|
|
41
|
-
|
|
29
|
+
### `npx 4bnode add-api <endpointName>`
|
|
42
30
|
|
|
43
|
-
|
|
44
|
-
4bnode add-mongo-schema User
|
|
45
|
-
```
|
|
31
|
+
Add a new API endpoint to your project.
|
|
46
32
|
|
|
47
|
-
### `4bnode add-
|
|
33
|
+
### `npx 4bnode add-mongo`
|
|
48
34
|
|
|
49
|
-
|
|
35
|
+
Integrate MongoDB into your project. This command sets up the necessary MongoDB configuration.
|
|
50
36
|
|
|
51
|
-
|
|
52
|
-
4bnode add-login
|
|
53
|
-
```
|
|
37
|
+
### `npx 4bnode add-mongo-schema <schemaName>`
|
|
54
38
|
|
|
55
|
-
|
|
39
|
+
Create a new MongoDB schema. You will be prompted to enter field details for the schema.
|
|
56
40
|
|
|
57
|
-
|
|
41
|
+
### `npx 4bnode add-login`
|
|
58
42
|
|
|
59
|
-
|
|
60
|
-
4bnode add-mongo-insert
|
|
61
|
-
```
|
|
43
|
+
Add a login template to an existing route in your project.
|
|
62
44
|
|
|
63
|
-
### `4bnode add-mongo-
|
|
45
|
+
### `npx 4bnode add-mongo-insert`
|
|
64
46
|
|
|
65
|
-
Add a
|
|
47
|
+
Add a route for inserting data into a MongoDB collection.
|
|
66
48
|
|
|
67
|
-
|
|
68
|
-
4bnode add-mongo-update
|
|
69
|
-
```
|
|
49
|
+
### `npx 4bnode add-mongo-update`
|
|
70
50
|
|
|
71
|
-
|
|
51
|
+
Add a route for updating data in a MongoDB collection.
|
|
72
52
|
|
|
73
|
-
|
|
53
|
+
### `npx 4bnode add-mongo-read`
|
|
74
54
|
|
|
75
|
-
|
|
76
|
-
4bnode add-mongo-read
|
|
77
|
-
```
|
|
55
|
+
Add a route for reading data from a MongoDB collection.
|
|
78
56
|
|
|
79
|
-
### `4bnode add-mongo-delete`
|
|
57
|
+
### `npx 4bnode add-mongo-delete`
|
|
80
58
|
|
|
81
|
-
Add a
|
|
59
|
+
Add a route for deleting data from a MongoDB collection.
|
|
82
60
|
|
|
83
|
-
|
|
84
|
-
4bnode add-mongo-delete
|
|
85
|
-
```
|
|
61
|
+
### `npx 4bnode add-socket`
|
|
86
62
|
|
|
87
|
-
|
|
63
|
+
Integrate Socket.io into your project for real-time communication.
|
|
88
64
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
```sh
|
|
92
|
-
4bnode add-socket
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### `4bnode add-websocket`
|
|
65
|
+
### `npx 4bnode add-websocket`
|
|
96
66
|
|
|
97
67
|
Add native WebSocket support to your project.
|
|
98
68
|
|
|
99
|
-
|
|
100
|
-
4bnode add-websocket
|
|
101
|
-
```
|
|
69
|
+
### `npx 4bnode add-serialport`
|
|
102
70
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
Integrate SerialPort functionality into your project. This command does the following:
|
|
71
|
+
Integrate SerialPort functionality into your project. This command:
|
|
106
72
|
|
|
107
73
|
- Prompts for Serial Port path and baud rate
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
- Installs required
|
|
74
|
+
- Updates `.env.development` and `.env.production`
|
|
75
|
+
- Injects SerialPort setup code into your `index.js`
|
|
76
|
+
- Installs required packages
|
|
111
77
|
|
|
112
|
-
|
|
113
|
-
4bnode add-serialport
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
Once added, your project will automatically initialize the serial port with the specified configuration and log incoming data.
|
|
117
|
-
|
|
118
|
-
Example incoming data log:
|
|
78
|
+
Once added, incoming data will be logged like:
|
|
119
79
|
|
|
120
80
|
```sh
|
|
121
81
|
Received data: <data from serial device>
|
|
@@ -123,33 +83,33 @@ Received data: <data from serial device>
|
|
|
123
83
|
|
|
124
84
|
## Examples
|
|
125
85
|
|
|
126
|
-
###
|
|
127
|
-
|
|
128
|
-
When you run the command to add a MongoDB schema, you will be prompted to enter the field details.
|
|
86
|
+
### Creating a New Project
|
|
129
87
|
|
|
130
88
|
```sh
|
|
131
|
-
4bnode
|
|
89
|
+
npx 4bnode init my-app
|
|
132
90
|
```
|
|
133
91
|
|
|
134
|
-
### Adding a
|
|
135
|
-
|
|
136
|
-
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.
|
|
92
|
+
### Adding a MongoDB Schema
|
|
137
93
|
|
|
138
94
|
```sh
|
|
139
|
-
4bnode add-
|
|
95
|
+
npx 4bnode add-mongo-schema User
|
|
140
96
|
```
|
|
141
97
|
|
|
142
|
-
|
|
98
|
+
### Adding a Login Template
|
|
143
99
|
|
|
144
|
-
|
|
100
|
+
```sh
|
|
101
|
+
npx 4bnode add-login
|
|
102
|
+
```
|
|
145
103
|
|
|
146
|
-
|
|
104
|
+
### Integrating SerialPort
|
|
147
105
|
|
|
148
106
|
```sh
|
|
149
|
-
4bnode add-
|
|
107
|
+
npx 4bnode add-serialport
|
|
150
108
|
```
|
|
151
109
|
|
|
152
|
-
|
|
110
|
+
## Real-time Communication Integration
|
|
111
|
+
|
|
112
|
+
### WebSocket
|
|
153
113
|
|
|
154
114
|
```js
|
|
155
115
|
router.get("/some-endpoint", (req, res) => {
|
|
@@ -162,15 +122,7 @@ router.get("/some-endpoint", (req, res) => {
|
|
|
162
122
|
});
|
|
163
123
|
```
|
|
164
124
|
|
|
165
|
-
### Socket.io
|
|
166
|
-
|
|
167
|
-
When you add Socket.io integration, it will automatically be added to your project.
|
|
168
|
-
|
|
169
|
-
```sh
|
|
170
|
-
4bnode add-socket
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
To use `req.io` in your route endpoints, you can access the Socket.io server as follows:
|
|
125
|
+
### Socket.io
|
|
174
126
|
|
|
175
127
|
```js
|
|
176
128
|
router.get("/some-endpoint", (req, res) => {
|
|
@@ -181,17 +133,9 @@ router.get("/some-endpoint", (req, res) => {
|
|
|
181
133
|
|
|
182
134
|
## Help
|
|
183
135
|
|
|
184
|
-
If you enter an invalid command, you will see the following message:
|
|
185
|
-
|
|
186
|
-
```sh
|
|
187
|
-
Unknown command. Use -h or --help for help.
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
You can also use `-h` or `--help` to get help information.
|
|
191
|
-
|
|
192
136
|
```sh
|
|
193
|
-
4bnode -h
|
|
194
|
-
4bnode --help
|
|
137
|
+
npx 4bnode -h
|
|
138
|
+
npx 4bnode --help
|
|
195
139
|
```
|
|
196
140
|
|
|
197
141
|
## 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.5",
|
|
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": {
|