tom-microservice 3.2.33 → 3.2.34
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/bin/listen.js +2 -5
- package/package.json +1 -1
- package/src/index.js +7 -3
- package/src/ward.js +1 -3
package/bin/listen.js
CHANGED
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
const express = require('express')
|
|
6
6
|
|
|
7
|
-
const createRoutes = require('../src/routes')
|
|
8
|
-
const logo = require('./logo')
|
|
9
|
-
|
|
10
7
|
const PORT =
|
|
11
8
|
process.env.PORT || process.env.port || process.env.TOM_PORT || 3000
|
|
12
9
|
|
|
@@ -16,11 +13,11 @@ const createServer = routes =>
|
|
|
16
13
|
.disable('x-powered-by')
|
|
17
14
|
|
|
18
15
|
module.exports = async (tomConfig, { port = PORT } = {}) => {
|
|
19
|
-
const routes =
|
|
16
|
+
const routes = require('../src/routes')(tomConfig)
|
|
20
17
|
|
|
21
18
|
createServer(routes).listen(port, () => {
|
|
22
19
|
console.log(
|
|
23
|
-
logo({
|
|
20
|
+
require('./logo')({
|
|
24
21
|
header: 'tom is running',
|
|
25
22
|
description: `http://localhost:${port}`
|
|
26
23
|
})
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -21,7 +21,7 @@ const loadCommand = (cmdName, { config, commands }) => {
|
|
|
21
21
|
})
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
const createTom = rawConfig => {
|
|
25
25
|
const config = createConfig(rawConfig)
|
|
26
26
|
return reduce(
|
|
27
27
|
COMMANDS,
|
|
@@ -33,7 +33,11 @@ module.exports = rawConfig => {
|
|
|
33
33
|
)
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const listen = require('../bin/listen')
|
|
37
|
+
|
|
38
|
+
module.exports = createTom
|
|
39
|
+
module.exports.createTom = createTom
|
|
40
|
+
module.exports.listen = listen
|
|
41
|
+
module.exports.createServer = listen.createServer
|
|
38
42
|
module.exports.createRoutes = require('./routes')
|
|
39
43
|
module.exports.createConfig = createConfig
|
package/src/ward.js
CHANGED
|
@@ -19,9 +19,7 @@ const wardCredential = (config, collection) => {
|
|
|
19
19
|
if (!isNil(cond)) {
|
|
20
20
|
return () => {
|
|
21
21
|
throw new TypeError(
|
|
22
|
-
`Need to specify a valid 'config.${
|
|
23
|
-
cond.key
|
|
24
|
-
}' or environment variable '${cond.env}'`
|
|
22
|
+
`Need to specify a valid 'config.${cond.key}' or environment variable '${cond.env}'`
|
|
25
23
|
)
|
|
26
24
|
}
|
|
27
25
|
}
|