diff --git a/bun.lockb b/bun.lockb new file mode 100644 index 0000000..fd86a71 Binary files /dev/null and b/bun.lockb differ diff --git a/package.json b/package.json index 4e2df44..94e68ba 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,12 @@ { - "name": "@bun-examples/elysia", + "name": "convertx-frontend", "version": "1.0.50", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "bun run --watch src/index.ts" }, "dependencies": { + "@elysiajs/static": "^1.0.2", "elysia": "latest" }, "devDependencies": { diff --git a/src/index.ts b/src/index.ts index 9c1f7a1..7b7b01f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,13 @@ import { Elysia } from "elysia"; +import { staticPlugin } from '@elysiajs/static' -const app = new Elysia().get("/", () => "Hello Elysia").listen(3000); +const app = new Elysia() + .use(staticPlugin({ + assets: "../frontend/", prefix: "/" + })) + .get("/", () => Bun.file("../frontend/index.html")) + .listen(3000); console.log( - `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}` + `🦊 Elysia is running at http://${app.server?.hostname}:${app.server?.port}` );