minimonolith 0.26.5 → 0.26.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.
Files changed (2) hide show
  1. package/README.md +19 -19
  2. 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';
@@ -62,7 +61,8 @@ await API.postModule(todo.name, todo.module, todo.model);
62
61
  await API.postDatabaseModule({
63
62
  DB_DIALECT: process.env.DB_DIALECT,
64
63
  DB_HOST: process.env.DB_HOST,
65
- DB_PORT: process.env.DB_PORT,
64
+ DB_PORT: process.env.DB_PORT ?
65
+ parseInt(process.env.DB_PORT, 10) : undefined,
66
66
  DB_DB: process.env.DB_DB,
67
67
  DB_USER: process.env.DB_USER,
68
68
  DB_PASS: process.env.DB_PASS,
@@ -88,7 +88,7 @@ import model from './model.js';
88
88
 
89
89
  export default {
90
90
  name: 'todo',
91
- module: {
91
+ methods: {
92
92
  'get': get,
93
93
  'post': post,
94
94
  'patch:id': patch,·
@@ -104,6 +104,7 @@ In this file, we define a Sequelize model for the `todo` module:
104
104
 
105
105
  ```js
106
106
  // todo/model.js
107
+
107
108
  export default moduleName => (orm, types) => {
108
109
  const schema = orm.define(moduleName, {
109
110
  name: {
@@ -142,24 +143,10 @@ export default async ({ body, MODELS }) => {
142
143
  }
143
144
  ```
144
145
 
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
146
  ## Database Authentication
160
147
 
161
148
  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
149
+ Assuming using same env variable names as at index.js above, the .env file should be like the following.
163
150
 
164
151
  For MySQL:
165
152
 
@@ -181,3 +168,16 @@ DB_DIALECT=sqlite
181
168
  DB_DB=<your_database_name>
182
169
  DB_STORAGE=:memory: # Need to also pass to API.postDatabaseModule()
183
170
  ```
171
+
172
+ ## Response Codes
173
+
174
+ ### Success
175
+
176
+ - POST -> 201
177
+ - DELETE -> 204
178
+ - Everything else -> 200
179
+ - Custom -> status value in handler.js return statement
180
+
181
+ ### Runtime Error
182
+
183
+ - ANY -> 500
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "minimonolith",
3
3
  "type": "module",
4
- "version": "0.26.5",
4
+ "version": "0.26.7",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
7
7
  "scripts": {