@uscreen.de/create-fastify-app 0.2.3 → 0.2.5
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/.gitlab-ci.yml.example
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
# cache:
|
|
4
4
|
# paths:
|
|
5
5
|
# - node_modules/
|
|
6
|
+
# - .yarn
|
|
6
7
|
|
|
7
8
|
# stages:
|
|
8
9
|
# - test
|
|
@@ -10,6 +11,6 @@
|
|
|
10
11
|
# test:
|
|
11
12
|
# stage: test
|
|
12
13
|
# script:
|
|
13
|
-
# - yarn install
|
|
14
|
+
# - yarn install --pure-lockfile --cache-folder .yarn
|
|
14
15
|
# - yarn test:ci
|
|
15
16
|
# coverage: '/^Statements\s*:\s*([^%]+)/'
|
package/package.json
CHANGED
package/skeleton/app/config.js
CHANGED
|
@@ -35,13 +35,13 @@ config.autoloads = [
|
|
|
35
35
|
]
|
|
36
36
|
|
|
37
37
|
config.swagger = {
|
|
38
|
-
routePrefix:
|
|
38
|
+
routePrefix: `${config.prefix}/docs`,
|
|
39
39
|
exposeRoute: true,
|
|
40
40
|
addModels: true
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
config.healthCheck = {
|
|
44
|
-
exposeStatusRoute:
|
|
44
|
+
exposeStatusRoute: `${config.prefix}/health`
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
module.exports = config
|
package/skeleton/app/server.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const fastify = require('fastify')
|
|
4
|
+
const { name, version } = require('../package.json')
|
|
4
5
|
const config = require('./config')
|
|
5
6
|
const app = require('./app')
|
|
6
7
|
|
|
7
8
|
const server = fastify({
|
|
8
9
|
logger: config.logEnabled
|
|
9
10
|
? {
|
|
10
|
-
level: config.logLevel
|
|
11
|
+
level: config.logLevel,
|
|
12
|
+
name: `${name} (v${version}) ${process.env.NODE_APP_INSTANCE}`
|
|
11
13
|
}
|
|
12
14
|
: false
|
|
13
15
|
})
|
|
@@ -19,9 +21,7 @@ server.register(app, config)
|
|
|
19
21
|
*/
|
|
20
22
|
server.ready(err => {
|
|
21
23
|
if (err) throw err
|
|
22
|
-
server.log.debug(
|
|
23
|
-
'serverlication ready, routes are set:\n' + server.printRoutes()
|
|
24
|
-
)
|
|
24
|
+
server.log.debug('server ready, routes are set:\n' + server.printRoutes())
|
|
25
25
|
})
|
|
26
26
|
|
|
27
27
|
/**
|
package/skeleton/pm2.config.js
CHANGED
|
@@ -22,7 +22,8 @@ module.exports = {
|
|
|
22
22
|
'pre-setup': 'yarn add pm2 pino-pretty;',
|
|
23
23
|
'post-setup':
|
|
24
24
|
'cp ./.env.example ../shared/.env; ln -s ../shared/.env ./.env',
|
|
25
|
-
'post-deploy':
|
|
25
|
+
'post-deploy':
|
|
26
|
+
'yarn install --production; ~/node_modules/.bin/pm2 reload pm2.config.js'
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
}
|