-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (23 loc) · 695 Bytes
/
Copy pathindex.js
File metadata and controls
28 lines (23 loc) · 695 Bytes
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
// Require the framework and instantiate it
const fastify = require('fastify')({ logger: true })
const path = require('path')
//const fetch = require('node-fetch')
fastify.register(require('fastify-static'), {
root: path.join(__dirname, 'public'),
prefix: '/'
})
fastify.register(require('./routes'), {
message: "hello"
})
// fastify.register(require('fastify-redis'), { url: constants.redisUrl, /* other redis options */ })
// Run the server!
const start = async () => {
try {
await fastify.listen(8080, "0.0.0.0")
fastify.log.info(`server listening on ${fastify.server.address().port}`)
} catch (error) {
fastify.log.error(error)
//process.exit(1)
}
}
start()