-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
45 lines (38 loc) · 1.23 KB
/
app.js
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
44
45
'use strict'
const path = require('path')
const AutoLoad = require('fastify-autoload')
const { hostname } = require('os')
module.exports = function (fastify, opts, next) {
// Place here your custom code!
fastify.register(
require('fastify-elasticsearch'), {
cloud: {
id: 'fastify-workshop:ZXVyb3BlLXdlc3QyLmdjcC5lbGFzdGljLWNsb3VkLmNvbSQzOGU4ZWI4ODY1ZmU0ZDI5OGY1Y2FiMmQzZjQ4OTc0MiRkMjYwZGYxNWExZjY0YWM1OTU2NjY1ZTJkOTk3OGNhOA=='
},
auth: {
username: 'workshop',
password: 'workshop-42'
}
}
)
fastify.register(
require('@delvedor/fastify-workshop-dataset'),
{ indexName: `${hostname().replace(/[^-_A-Za-z0-9]/g, '_').toLowerCase()}-tweets` }
)
// 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'),
options: Object.assign({}, opts)
})
// This loads all plugins defined in services
// define your routes in one of these
fastify.register(AutoLoad, {
dir: path.join(__dirname, 'services'),
options: Object.assign({}, opts)
})
// Make sure to call next when done
next()
}