diff --git a/bun.lockb b/bun.lockb index 583e403..c44786e 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index ab76bc3..4800418 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,10 @@ "version": "1.0.50", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "dev": "bun run --watch src/index.ts" + "dev": "bun run --watch src/index.tsx" }, "dependencies": { + "@elysiajs/html": "^0.8.0", "elysia": "latest" }, "devDependencies": { diff --git a/src/frontend/index.html b/src/frontend/index.html deleted file mode 100644 index a48d4f8..0000000 --- a/src/frontend/index.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - Caleb's Blog - - -

Hello

- - - - \ No newline at end of file diff --git a/src/frontend/index.tsx b/src/frontend/index.tsx new file mode 100644 index 0000000..3a6ec74 --- /dev/null +++ b/src/frontend/index.tsx @@ -0,0 +1,17 @@ +export function Index() { + return ( + + + + + + Caleb's Blog + + +

Hello

+ + + + ) +} + diff --git a/src/index.ts b/src/index.tsx similarity index 64% rename from src/index.ts rename to src/index.tsx index ccaaf5e..19ad78e 100644 --- a/src/index.ts +++ b/src/index.tsx @@ -1,7 +1,10 @@ import { Elysia } from "elysia"; +import { html } from "@elysiajs/html"; +import { Index } from "./frontend/index"; const app = new Elysia() - .get("/", () => Bun.file("./src/frontend/index.html")) + .use(html()) + .get("/", () => Index()) .get('/htmx.min.js', () => Bun.file("./src/frontend/htmx.min.js")) .get("/content/post", () => "I'm from the server") .listen(3000); @@ -9,9 +12,3 @@ const app = new Elysia() console.log( `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}` ); - - -function ssr() { - let appShell = Bun.file('./src/frontend/shell.html').text() - return appShell -} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 1ca2350..a3e7a24 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,11 +13,11 @@ /* Language and Environment */ "target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - // "jsx": "preserve", /* Specify what JSX code is generated. */ + "jsx": "react", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + "jsxFactory": "Html.createElement", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + "jsxFragmentFactory": "Html.Fragment", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ @@ -98,6 +98,6 @@ /* Completeness */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "skipLibCheck": true } }