serving built app on port 3000 when starting with fastify
this eases up scalingo deployment
This commit is contained in:
971
website/package-lock.json
generated
971
website/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
||||
"version": "0.1.0",
|
||||
"scripts": {
|
||||
"dev": "astro dev",
|
||||
"start": "astro dev",
|
||||
"start": "node ./server.mjs",
|
||||
"build-backgrounds": "node ./bin/build-services-backgrounds.mjs",
|
||||
"build": "astro check && npm run build-backgrounds && astro build",
|
||||
"copy-logos": "cp -r ./node_modules/@gouvfr-lasuite/integration/dist/logos/* ./src/assets/logos",
|
||||
@@ -18,11 +18,13 @@
|
||||
"@astrojs/markdown-remark": "^5.1.0",
|
||||
"@astrojs/react": "^3.3.1",
|
||||
"@astrojs/starlight": "^0.21.5",
|
||||
"@fastify/static": "^7.0.3",
|
||||
"@gouvfr-lasuite/integration": "^0.1.0",
|
||||
"@types/react": "^18.3.1",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@types/react-syntax-highlighter": "^15.5.11",
|
||||
"astro": "^4.3.5",
|
||||
"fastify": "^4.26.2",
|
||||
"prettier": "^3.2.5",
|
||||
"prettier-plugin-astro": "^0.13.0",
|
||||
"prismjs": "^1.29.0",
|
||||
|
||||
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