mirror of
https://github.com/kou029w/_.git
synced 2025-01-31 06:18:07 +00:00
22 lines
587 B
TypeScript
22 lines
587 B
TypeScript
|
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)
|