-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
43 lines (37 loc) · 1.23 KB
/
app.js
File metadata and controls
43 lines (37 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
'use strict'
const path = require('path')
const AutoLoad = require('@fastify/autoload')
// Pass --options via CLI arguments in command to enable these options.
module.exports.options = {}
module.exports = async function (fastify, opts) {
// Place here your custom code!
fastify.register(AutoLoad, {
dir: path.join(__dirname, 'schemas'),
indexPattern: /^loader.js$/i
})
// Do not touch the following lines
// This loads all plugins defined in plugins
// those should be support plugins that are reused
// through your application
fastify.register(AutoLoad, {
dir: path.join(__dirname, 'plugins'),
dirNameRoutePrefix: false,
ignorePattern: /.*.no-load\.js/,
// ignorePattern: /^((?!load\.js).)*$/,
indexPattern: /^no$/i,
options: { ...opts }
})
// This loads all plugins defined in routes
// define your routes in one of these
fastify.register(AutoLoad, {
dir: path.join(__dirname, 'routes'),
indexPattern: /.*routes(\.js|\.cjs)$/i,
ignorePattern: /.*\.js/,
autoHooksPattern: /.*hooks(\.js|\.cjs)$/i,
autoHooks: true,
cascadeHooks: true,
options: Object.assign({}, opts)
})
fastify.log.info('The .env file has been read %s',
process.env.MYSQL_HARDWARE_DATABASE_URL)
}