Skip to content

Commit

Permalink
Use promise based fastify init handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
pastelsky committed Oct 18, 2020
1 parent ecd75d6 commit 5cdfde0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
13 changes: 9 additions & 4 deletions build-service/index.js
Expand Up @@ -40,7 +40,12 @@ fastify.get('/exports', async (req, res) => {
}
})

fastify.listen(7002, '127.0.0.1', function (err) {
if (err) throw err
console.log(`server listening on ${fastify.server.address().port}`)
})
fastify
.listen(7002)
.then(() => {
console.log(`server listening on ${fastify.server.address().port}`)
})
.catch(err => {
console.error(err)
process.exit(1)
})
13 changes: 9 additions & 4 deletions cache-service/index.js
Expand Up @@ -24,7 +24,12 @@ fastify.post('/package-cache', postPackageSizeMiddlware)
fastify.get('/exports-cache', getExportsSizeMiddlware)
fastify.post('/exports-cache', postExportsSizeMiddleware)

fastify.listen(7001, '127.0.0.1', function (err) {
if (err) throw err
console.log(`server listening on ${fastify.server.address().port}`)
})
fastify
.listen(7001)
.then(() => {
console.log(`server listening on ${fastify.server.address().port}`)
})
.catch(err => {
console.error(err)
process.exit(1)
})

0 comments on commit 5cdfde0

Please sign in to comment.