feat: build as middleware & use fastify
This commit is contained in:
parent
173d584d80
commit
d3abab1efc
4 changed files with 615 additions and 12 deletions
|
@ -6,6 +6,6 @@ import node from "@astrojs/node";
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
output: "server",
|
output: "server",
|
||||||
adapter: node({
|
adapter: node({
|
||||||
mode: "standalone"
|
mode: "middleware"
|
||||||
})
|
})
|
||||||
});
|
});
|
|
@ -21,9 +21,12 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/node": "^8.3.2",
|
"@astrojs/node": "^8.3.2",
|
||||||
"@ayco/astro-resume": "^0.4.0",
|
"@ayco/astro-resume": "^0.4.1",
|
||||||
"@extractus/article-extractor": "^8.0.10",
|
"@extractus/article-extractor": "^8.0.10",
|
||||||
|
"@fastify/middie": "^8.3.1",
|
||||||
|
"@fastify/static": "^7.0.4",
|
||||||
"astro-iconify": "^1.2.0",
|
"astro-iconify": "^1.2.0",
|
||||||
|
"fastify": "^4.28.1",
|
||||||
"sass": "^1.77.8",
|
"sass": "^1.77.8",
|
||||||
"ultrahtml": "^1.5.3"
|
"ultrahtml": "^1.5.3"
|
||||||
}
|
}
|
||||||
|
|
602
pnpm-lock.yaml
602
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
16
server.mjs
Normal file
16
server.mjs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import Fastify from 'fastify';
|
||||||
|
import fastifyMiddie from '@fastify/middie';
|
||||||
|
import fastifyStatic from '@fastify/static';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
import { handler as ssrHandler } from './dist/server/entry.mjs';
|
||||||
|
|
||||||
|
const app = Fastify({ logger: true });
|
||||||
|
|
||||||
|
await app
|
||||||
|
.register(fastifyStatic, {
|
||||||
|
root: fileURLToPath(new URL('./dist/client', import.meta.url)),
|
||||||
|
})
|
||||||
|
.register(fastifyMiddie);
|
||||||
|
app.use(ssrHandler);
|
||||||
|
|
||||||
|
app.listen({ port: 8080 });
|
Loading…
Reference in a new issue