1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-02-02 15:18:37 +00:00

Compare commits

...

5 commits

Author SHA1 Message Date
dependabot[bot]
c6b9f13693
Merge 0f19ff4d97 into 07d437da3d 2024-03-23 15:08:08 +00:00
07d437da3d
fixed root 2024-03-23 19:54:27 +09:00
6a43e9ddbe
create astro-fastify-ssg 2024-03-23 19:49:38 +09:00
c5b6327a2e
create astro-fastify 2024-03-23 19:37:55 +09:00
dependabot[bot]
0f19ff4d97
Bump semver from 7.3.7 to 7.5.4 in /tsm-vs-esno
Bumps [semver](https://github.com/npm/node-semver) from 7.3.7 to 7.5.4.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.3.7...v7.5.4)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-09 08:21:42 +00:00
14 changed files with 9113 additions and 3 deletions

View file

@ -0,0 +1,19 @@
{
"name": "@kou029w/astro-fastify-ssg",
"version": "0.0.0",
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"dev": "fastify start --log-level=info --debug --watch server.js -- --dev",
"build": "astro build",
"start": "fastify start server.js"
},
"devDependencies": {
"@fastify/http-proxy": "^9.5.0",
"@fastify/static": "^7.0.1",
"astro": "^4.5.9",
"fastify": "^4.26.2",
"fastify-cli": "^6.1.1"
}
}

4440
astro-fastify-ssg/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
public

View file

@ -0,0 +1,25 @@
import fastifyStatic from "@fastify/static";
import { fileURLToPath } from "node:url";
/** @type {import("fastify").FastifyPluginAsync} */
const app = async (fastify, opts) => {
fastify.get("/hello", async () => "hello");
if (opts.dev) {
const astro = await import("astro");
const astroDevServer = await astro.dev({
root: fileURLToPath(import.meta.resolve(".")),
});
await fastify.register(await import("@fastify/http-proxy"), {
upstream: `http://localhost:${astroDevServer.address.port}`,
});
} else {
await fastify.register(fastifyStatic, {
root: fileURLToPath(import.meta.resolve("./dist")),
});
}
fastify.get("/world", async () => "world");
};
export default app;

1
astro-fastify-ssg/src/env.d.ts vendored Normal file
View file

@ -0,0 +1 @@
/// <reference types="astro/client" />

View file

@ -0,0 +1 @@
**Hello, World!**

View file

@ -0,0 +1,9 @@
import { defineConfig } from "astro/config";
import node from "@astrojs/node";
export default defineConfig({
output: "server",
adapter: node({
mode: "middleware",
}),
});

View file

@ -0,0 +1,21 @@
{
"name": "@kou029w/astro-fastify",
"version": "0.0.0",
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"dev": "fastify start --log-level=info --debug --watch server.js -- --dev",
"build": "astro build",
"start": "fastify start server.js"
},
"devDependencies": {
"@astrojs/node": "^8.2.5",
"@fastify/http-proxy": "^9.5.0",
"@fastify/middie": "^8.3.0",
"@fastify/static": "^7.0.1",
"astro": "^4.5.9",
"fastify": "^4.26.2",
"fastify-cli": "^6.1.1"
}
}

4553
astro-fastify/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
public

29
astro-fastify/server.js Normal file
View file

@ -0,0 +1,29 @@
import fastifyMiddie from "@fastify/middie";
import fastifyStatic from "@fastify/static";
import { fileURLToPath } from "node:url";
/** @type {import("fastify").FastifyPluginAsync} */
const app = async (fastify, opts) => {
fastify.get("/hello", async () => "hello");
if (opts.dev) {
const astro = await import("astro");
const astroDevServer = await astro.dev({
root: fileURLToPath(import.meta.resolve(".")),
});
await fastify.register(await import("@fastify/http-proxy"), {
upstream: `http://localhost:${astroDevServer.address.port}`,
});
} else {
await fastify.register(fastifyStatic, {
root: fileURLToPath(import.meta.resolve("./dist/client")),
});
await fastify.register(fastifyMiddie);
const astroServer = await import("./dist/server/entry.mjs");
fastify.use(astroServer.handler);
}
fastify.get("/world", async () => "world");
};
export default app;

1
astro-fastify/src/env.d.ts vendored Normal file
View file

@ -0,0 +1 @@
/// <reference types="astro/client" />

View file

@ -0,0 +1,9 @@
import type { APIRoute } from "astro";
export const GET: APIRoute = () => {
return new Response(
JSON.stringify({
number: Math.random(),
}),
);
};

View file

@ -357,9 +357,9 @@ path-key@^3.1.0:
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
semver@^7.0.0:
version "7.3.7"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f"
integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==
version "7.5.4"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
dependencies:
lru-cache "^6.0.0"