|
|
@ -1,7 +1,6 @@ |
|
|
|
import { config } from 'dotenv' |
|
|
|
import fastify from 'fastify' |
|
|
|
import helmet from 'fastify-helmet' |
|
|
|
import cors from 'fastify-cors' |
|
|
|
import swagger from 'fastify-swagger' |
|
|
|
import api from './plugins/api' |
|
|
|
|
|
|
@ -15,11 +14,6 @@ const server = fastify({ |
|
|
|
}) |
|
|
|
|
|
|
|
server.register(helmet) |
|
|
|
server.register(cors, { |
|
|
|
origin: true, |
|
|
|
credentials: false, |
|
|
|
maxAge: 2592000, |
|
|
|
}) |
|
|
|
|
|
|
|
server.register(swagger, { |
|
|
|
routePrefix: '/docs', |
|
|
@ -39,7 +33,7 @@ server.register(swagger, { |
|
|
|
{ name: 'user', description: 'User endpoints.' }, |
|
|
|
], |
|
|
|
host: 'localhost', |
|
|
|
schemes: ['http'], |
|
|
|
schemes: ['http', 'https'], |
|
|
|
}, |
|
|
|
}) |
|
|
|
|
|
|
@ -52,11 +46,11 @@ server.ready(err => { |
|
|
|
|
|
|
|
const port = parseInt(process.env.PORT!, 10) |
|
|
|
|
|
|
|
server.listen(port, '0.0.0.0', (err, address) => { |
|
|
|
server.listen(port, (err, address) => { |
|
|
|
if (err) { |
|
|
|
server.log.error(err) |
|
|
|
process.exit(1) |
|
|
|
} |
|
|
|
|
|
|
|
server.log.info(`✊🏾 Flexor listening at ${address}`) |
|
|
|
server.log.info(`✊🏾 Flexor API listening at ${address}`) |
|
|
|
}) |