create-sip 0.14.1 → 0.14.3
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
CHANGED
|
@@ -14,10 +14,10 @@ Copy **config/default.json.example** to **config/default.json** file.
|
|
|
14
14
|
|
|
15
15
|
## APP KEY generation
|
|
16
16
|
|
|
17
|
-
Run the genkey
|
|
17
|
+
Run the genkey:
|
|
18
18
|
|
|
19
19
|
```cmd
|
|
20
|
-
node
|
|
20
|
+
node op key:generate
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Database settings
|
|
@@ -44,7 +44,7 @@ After installing the appropriate dependencies, it can be used:
|
|
|
44
44
|
* snowflake
|
|
45
45
|
* oracle
|
|
46
46
|
|
|
47
|
-
With the `sqlite` option, the
|
|
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
48
|
|
|
49
49
|
## Starting
|
|
50
50
|
|
|
@@ -60,6 +60,17 @@ Run productum:
|
|
|
60
60
|
npm start
|
|
61
61
|
```
|
|
62
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 create model thing
|
|
69
|
+
node op create controller thing
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The name after the model and controller statements must be given in the singular.
|
|
73
|
+
|
|
63
74
|
## Licence
|
|
64
75
|
|
|
65
76
|
May be freely distributed under the MIT license.
|
|
@@ -3,7 +3,7 @@ import Thing from '../models/thing.js'
|
|
|
3
3
|
const ThingController = {
|
|
4
4
|
async index(req, res) {
|
|
5
5
|
try {
|
|
6
|
-
ThingController.tryIndex(req, res)
|
|
6
|
+
await ThingController.tryIndex(req, res)
|
|
7
7
|
}catch(error) {
|
|
8
8
|
res.status(500)
|
|
9
9
|
res.json({
|
|
@@ -22,7 +22,7 @@ const ThingController = {
|
|
|
22
22
|
},
|
|
23
23
|
async show(req, res) {
|
|
24
24
|
try {
|
|
25
|
-
ThingController.tryShow(req, res)
|
|
25
|
+
await ThingController.tryShow(req, res)
|
|
26
26
|
}catch(error) {
|
|
27
27
|
res.status(500)
|
|
28
28
|
res.json({
|
|
@@ -41,7 +41,7 @@ const ThingController = {
|
|
|
41
41
|
},
|
|
42
42
|
async create(req, res) {
|
|
43
43
|
try {
|
|
44
|
-
ThingController.tryCreate(req, res)
|
|
44
|
+
await ThingController.tryCreate(req, res)
|
|
45
45
|
}catch(error) {
|
|
46
46
|
res.status(500)
|
|
47
47
|
res.json({
|
|
@@ -93,7 +93,7 @@ const ThingController = {
|
|
|
93
93
|
},
|
|
94
94
|
async destroy(req, res) {
|
|
95
95
|
try {
|
|
96
|
-
ThingController.tryDestroy(req, res)
|
|
96
|
+
await ThingController.tryDestroy(req, res)
|
|
97
97
|
}catch(error) {
|
|
98
98
|
res.status(500)
|
|
99
99
|
res.json({
|
package/manager.js
CHANGED
|
@@ -73,6 +73,8 @@ const genExpressApi = (target) => {
|
|
|
73
73
|
console.log('Usable commands:');
|
|
74
74
|
console.log(' node op create model thing');
|
|
75
75
|
console.log(' node op create controller thing');
|
|
76
|
+
console.log('The model and controller names must be');
|
|
77
|
+
console.log('given in the singular');
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
module.exports = {
|