create-sip 1.3.6 → 1.3.7
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/expressapi/README.md +2 -169
- package/package.json +1 -1
package/expressapi/README.md
CHANGED
|
@@ -2,178 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Express based REST API template
|
|
4
4
|
|
|
5
|
-
## Install
|
|
5
|
+
## Install dependencies
|
|
6
6
|
|
|
7
7
|
```cmd
|
|
8
8
|
npm install
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Copy config file
|
|
12
|
-
|
|
13
|
-
Copy **config/default.json.example** to **config/default.json** file.
|
|
14
|
-
|
|
15
|
-
## APP KEY generation
|
|
16
|
-
|
|
17
|
-
Run the genkey:
|
|
18
|
-
|
|
19
|
-
```cmd
|
|
20
|
-
node op key:generate
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Database settings
|
|
24
|
-
|
|
25
|
-
The database settings can be found at the following location:
|
|
26
|
-
|
|
27
|
-
* config/default.json
|
|
28
|
-
|
|
29
|
-
### Database dialect
|
|
30
|
-
|
|
31
|
-
The default database is an in-memory database. Its contents are cleared after the server is restarted.
|
|
32
|
-
|
|
33
|
-
One of:
|
|
34
|
-
|
|
35
|
-
* sqlite
|
|
36
|
-
* mariadb
|
|
37
|
-
|
|
38
|
-
After installing the appropriate dependencies, it can be used:
|
|
39
|
-
|
|
40
|
-
* mysql
|
|
41
|
-
* postgres
|
|
42
|
-
* mssql
|
|
43
|
-
* db2
|
|
44
|
-
* snowflake
|
|
45
|
-
* oracle
|
|
46
|
-
|
|
47
|
-
With the `sqlite` option, the usual path setting is `database.sqlite`. The default storage is :memory:, where data is stored in memory only.
|
|
48
|
-
|
|
49
|
-
## Starting
|
|
50
|
-
|
|
51
|
-
For development:
|
|
52
|
-
|
|
53
|
-
```cmd
|
|
54
9
|
npm run dev
|
|
55
10
|
```
|
|
56
11
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
```cmd
|
|
60
|
-
npm start
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Model and controller creation
|
|
64
|
-
|
|
65
|
-
You can generate a model and controller with the following commands:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
node op make:model something
|
|
69
|
-
node op make:controller something
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
The name after the model and controller statements must be given in the singular. Controller generation automatically appends the "Controller" suffix.
|
|
73
|
-
|
|
74
|
-
## Admin user
|
|
75
|
-
|
|
76
|
-
The admin user can be created with the following command:
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
node op admin:generate
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
The command will prompt for the password.
|
|
83
|
-
|
|
84
|
-
## Config generation
|
|
85
|
-
|
|
86
|
-
The next command generates the default config file:
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
node op conf:generate
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## Database import
|
|
93
|
-
|
|
94
|
-
The database can be seeded with the following command:
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
node op db:import <model_name> <file_path>
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
The model name must be given in the singular and lowercase. The file extension must be:
|
|
101
|
-
|
|
102
|
-
* .json
|
|
103
|
-
* .csv
|
|
104
|
-
|
|
105
|
-
The keys in the JSON file and the field names in the CSV file must match the model fields.
|
|
106
|
-
|
|
107
|
-
If the CSV file contains quotation marks, they are automatically removed.
|
|
108
|
-
|
|
109
|
-
## Database synchronization
|
|
110
|
-
|
|
111
|
-
Models and database tables can be synchronized, but this can be dangerous.
|
|
112
|
-
|
|
113
|
-
Database synchronization can be set up in the app/models/modrels.js file. Default values are:
|
|
114
|
-
|
|
115
|
-
```js
|
|
116
|
-
{ alter: true }
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
This preserves the data and existing structure.
|
|
120
|
-
|
|
121
|
-
Possible values:
|
|
122
|
-
|
|
123
|
-
```js
|
|
124
|
-
{ force: true }
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
The latter deletes the contents of the database table!
|
|
128
|
-
|
|
129
|
-
If the value is false, there is no synchronization in either case.
|
|
130
|
-
|
|
131
|
-
## Migration
|
|
132
|
-
|
|
133
|
-
Generate a migration:
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
node op make/migration thing
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Run all migration:
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
node op migration:run
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
Run a migration:
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
node op migration:run <migration_name>
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
Rollback a migration:
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
node op migration:rollback
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
Rollback two migrations:
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
node op migration:rollback 2
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
Reset the database:
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
node op migration:reset
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
Reset the database and run all migrations:
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
node op migration:fresh
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
## Licence
|
|
176
|
-
|
|
177
|
-
May be freely distributed under the MIT license.
|
|
178
|
-
|
|
179
|
-
Copyright (c) 2023 Sallai András
|
|
12
|
+
See the docs directory for details.
|