serving built app on port 3000 when starting with fastify
this eases up scalingo deployment
This commit is contained in:
17
website/server.mjs
Normal file
17
website/server.mjs
Normal file
@@ -0,0 +1,17 @@
|
||||
import { join } from "path"
|
||||
import Fastify from "fastify"
|
||||
import staticMiddleware from "@fastify/static"
|
||||
const fastify = Fastify({
|
||||
logger: true,
|
||||
})
|
||||
|
||||
fastify.register(staticMiddleware, {
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user