- correct a few content mistakes - activate compression on production server - suppress a few TS warnings (with anys, I know)
21 lines
442 B
JavaScript
21 lines
442 B
JavaScript
import { join } from "path"
|
|
import Fastify from "fastify"
|
|
import fsfStatic from "@fastify/static"
|
|
import fsfCompress from "@fastify/compress"
|
|
const fastify = Fastify({
|
|
logger: true,
|
|
})
|
|
|
|
fastify.register(fsfCompress)
|
|
|
|
fastify.register(fsfStatic, {
|
|
root: join(import.meta.dirname, process.env.STATIC_DIR || "dist"),
|
|
})
|
|
|
|
try {
|
|
fastify.listen({ port: process.env.PORT || 3000 })
|
|
} catch (err) {
|
|
fastify.log.error(err)
|
|
process.exit(1)
|
|
}
|