some ci fixes
This commit is contained in:
@@ -1,25 +1,28 @@
|
||||
import { Elysia } from "elysia";
|
||||
import { html } from "@elysiajs/html";
|
||||
import { staticPlugin } from "@elysiajs/static";
|
||||
|
||||
// import { autoroutes } from "elysia-autoroutes";
|
||||
// import { Store } from "./store";
|
||||
// // @ts-ignore
|
||||
// import data from "../package.json";
|
||||
|
||||
import { HomeLayout } from "./layout";
|
||||
import { Landing } from "./landing";
|
||||
|
||||
export const server = new Elysia()
|
||||
.use(html())
|
||||
.use(staticPlugin())
|
||||
.get("/public/htmx.js", () =>
|
||||
Bun.file("node_modules/htmx.org/dist/htmx.min.js"),
|
||||
)
|
||||
// .get("/public/htmx.js", () =>
|
||||
// Bun.file("node_modules/htmx.org/dist/htmx.min.js"),
|
||||
// )
|
||||
// .state("store", new Store())
|
||||
// .state("version", data.version)
|
||||
.onError(({ code, error }) => {
|
||||
console.error(code, error);
|
||||
})
|
||||
.get("/", ({html}) => html(<HomeLayout><div>hello world</div></HomeLayout>))
|
||||
.get("/", ({html}) => html(<HomeLayout><Landing></Landing></HomeLayout>))
|
||||
.post("/clicked", ()=> <div>Hello?</div>)
|
||||
|
||||
.listen(Bun.env["PORT"] ?? 3000);
|
||||
|
||||
|
||||
10
frontend/src/landing.tsx
Normal file
10
frontend/src/landing.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import * as elements from "typed-html";
|
||||
|
||||
const Landing = ({ children }: elements.Children) => `
|
||||
<button hx-post="/clicked" hx-swap="outerHTML" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
|
||||
Click me
|
||||
</button>
|
||||
${children}
|
||||
`;
|
||||
|
||||
export { Landing }
|
||||
@@ -1,4 +1,5 @@
|
||||
import { html } from "@elysiajs/html";
|
||||
import * as elements from "typed-html";
|
||||
|
||||
const HomeLayout = ({ children }: elements.Children) => `
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
@@ -7,13 +8,6 @@ const HomeLayout = ({ children }: elements.Children) => `
|
||||
<title>BETH STACK</title>
|
||||
</head>
|
||||
<body class="h-screen w-screen flex flex-col gap-3 items-center justify-center">
|
||||
<span class='text-xl font-semibold'>BETH STACK</span>
|
||||
<div class='flex flex-col items-center justify-center gap-2 mb-5'>
|
||||
<span class='text-neutral-500 font-semibold'>Bun 1.0</span>
|
||||
<span class='text-violet-500 font-semibold'>Elysia</span>
|
||||
<span class='text-lime-500 font-semibold'>Turso</span>
|
||||
<span class='text-sky-500 font-semibold'>Htmx</span>
|
||||
</div>
|
||||
${children}
|
||||
</body>
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user