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({
|
||||
output: "server",
|
||||
adapter: node({
|
||||
mode: "standalone"
|
||||
mode: "middleware"
|
||||
})
|
||||
});
|
|
@ -14,16 +14,19 @@
|
|||
"build": "astro build",
|
||||
"publish:patch": "npm version patch && npm publish --access public",
|
||||
"publish:minor": "npm version minor && npm publish --access public",
|
||||
"deploy": "astro build && scp -r dist ayo@ayco.io:~/cozy/"
|
||||
"deploy": "astro build && scp -r dist ayo@ayco.io:~/cozy/"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "^4.12.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/node": "^8.3.2",
|
||||
"@ayco/astro-resume": "^0.4.0",
|
||||
"@ayco/astro-resume": "^0.4.1",
|
||||
"@extractus/article-extractor": "^8.0.10",
|
||||
"@fastify/middie": "^8.3.1",
|
||||
"@fastify/static": "^7.0.4",
|
||||
"astro-iconify": "^1.2.0",
|
||||
"fastify": "^4.28.1",
|
||||
"sass": "^1.77.8",
|
||||
"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