minimonolith 0.26.5 → 0.26.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 +17 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ This file is used for local development. It runs a local server using `minimonol
|
|
|
30
30
|
|
|
31
31
|
```js
|
|
32
32
|
// server.js
|
|
33
|
+
|
|
33
34
|
import { getServerFactory } from 'minimonolith';
|
|
34
35
|
|
|
35
36
|
import dotenv from 'dotenv';
|
|
@@ -50,8 +51,6 @@ This file serves as the root of the code in a deployed AWS Lambda:
|
|
|
50
51
|
```js
|
|
51
52
|
// index.js
|
|
52
53
|
|
|
53
|
-
'use strict';
|
|
54
|
-
|
|
55
54
|
import { getNewAPI } from 'minimonolith';
|
|
56
55
|
|
|
57
56
|
import todo from './todo/index.js';
|
|
@@ -88,7 +87,7 @@ import model from './model.js';
|
|
|
88
87
|
|
|
89
88
|
export default {
|
|
90
89
|
name: 'todo',
|
|
91
|
-
|
|
90
|
+
methods: {
|
|
92
91
|
'get': get,
|
|
93
92
|
'post': post,
|
|
94
93
|
'patch:id': patch,·
|
|
@@ -104,6 +103,7 @@ In this file, we define a Sequelize model for the `todo` module:
|
|
|
104
103
|
|
|
105
104
|
```js
|
|
106
105
|
// todo/model.js
|
|
106
|
+
|
|
107
107
|
export default moduleName => (orm, types) => {
|
|
108
108
|
const schema = orm.define(moduleName, {
|
|
109
109
|
name: {
|
|
@@ -142,24 +142,10 @@ export default async ({ body, MODELS }) => {
|
|
|
142
142
|
}
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
## Response Codes
|
|
146
|
-
|
|
147
|
-
### Success
|
|
148
|
-
|
|
149
|
-
- POST -> 201
|
|
150
|
-
- DELETE -> 204
|
|
151
|
-
- Everything else -> 200
|
|
152
|
-
- Custom -> status value in handler.js return statement
|
|
153
|
-
|
|
154
|
-
### Runtime Error
|
|
155
|
-
|
|
156
|
-
- ANY -> 500
|
|
157
|
-
|
|
158
|
-
|
|
159
145
|
## Database Authentication
|
|
160
146
|
|
|
161
147
|
To set up authentication for the database you need to pass necessary variables to postDatabaseModule as at index.js above.
|
|
162
|
-
Assuming using same env variable names as at index.js above
|
|
148
|
+
Assuming using same env variable names as at index.js above, the .env file should be like the following.
|
|
163
149
|
|
|
164
150
|
For MySQL:
|
|
165
151
|
|
|
@@ -181,3 +167,16 @@ DB_DIALECT=sqlite
|
|
|
181
167
|
DB_DB=<your_database_name>
|
|
182
168
|
DB_STORAGE=:memory: # Need to also pass to API.postDatabaseModule()
|
|
183
169
|
```
|
|
170
|
+
|
|
171
|
+
## Response Codes
|
|
172
|
+
|
|
173
|
+
### Success
|
|
174
|
+
|
|
175
|
+
- POST -> 201
|
|
176
|
+
- DELETE -> 204
|
|
177
|
+
- Everything else -> 200
|
|
178
|
+
- Custom -> status value in handler.js return statement
|
|
179
|
+
|
|
180
|
+
### Runtime Error
|
|
181
|
+
|
|
182
|
+
- ANY -> 500
|