1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-31 06:18:07 +00:00
_/frourio/server/index.ts

22 lines
587 B
TypeScript
Raw Normal View History

2020-10-12 13:35:33 +09:00
import path from 'path'
import Fastify from 'fastify'
import helmet from 'fastify-helmet'
import cors from 'fastify-cors'
import fastifyStatic from 'fastify-static'
import fastifyAuth from 'fastify-auth'
import { SERVER_PORT, BASE_PATH } from './service/envValues'
import server from './$server'
const fastify = Fastify()
fastify.register(helmet)
fastify.register(cors)
fastify.register(fastifyStatic, {
root: path.join(__dirname, 'public'),
prefix: BASE_PATH
})
fastify.register(fastifyAuth).after(() => {
server(fastify, { basePath: BASE_PATH })
})
fastify.listen(SERVER_PORT)