add html plugin

This commit is contained in:
C4illin
2024-04-09 15:42:08 +02:00
parent 277e70318d
commit b0c2dba1d6
6 changed files with 24 additions and 2 deletions

BIN
bun.lockb

Binary file not shown.

View File

@@ -6,6 +6,7 @@
"dev": "bun run --watch src/index.ts"
},
"dependencies": {
"@elysiajs/html": "^1.0.2",
"@elysiajs/static": "^1.0.2",
"elysia": "latest"
},

View File

@@ -1,11 +1,13 @@
import { Elysia } from "elysia";
import { staticPlugin } from '@elysiajs/static'
import { html } from '@elysiajs/html'
const app = new Elysia()
.use(html())
.use(staticPlugin({
assets: "../frontend/", prefix: "/"
assets: "src/public/", prefix: "/"
}))
.get("/", () => Bun.file("../frontend/index.html"))
.get("/", () => Bun.file("src/pages/index.html"))
.listen(3000);
console.log(

15
src/pages/index.html Normal file
View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ConvertX</title>
<link rel="stylesheet" href="pico.lime.min.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="container">
<h1>Hello world!</h1>
</main>
</body>
</html>

4
src/public/pico.lime.min.css vendored Normal file

File diff suppressed because one or more lines are too long

0
src/public/style.css Normal file
View File