feat: Webクライアントを追加

This commit is contained in:
2023-04-13 15:56:25 +09:00
parent a23f26a399
commit 1efd6557b5
10 changed files with 2798 additions and 0 deletions
@@ -90,6 +90,7 @@ fun Application.parent() {
configureKoin(module)
configureHTTP()
configureStaticRouting()
configureMonitoring()
configureSerialization()
register(inject<IUserAuthService>().value)
@@ -0,0 +1,21 @@
package dev.usbharu.hideout.plugins
import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.http.content.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
fun Application.configureStaticRouting() {
routing {
get("/") {
call.respondText(
String.javaClass.classLoader.getResourceAsStream("static/index.html").readAllBytes().decodeToString(),
contentType = ContentType.Text.Html
)
}
static("/") {
resources("static")
}
}
}
+5
View File
@@ -0,0 +1,5 @@
import {Component} from "solid-js";
export const App:Component = () => {
return (<p>aaa</p>)
}
+15
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" />
<meta name="theme-color" content="#000000" />
<title>Solid App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script src="/index.tsx" type="module"></script>
</body>
</html>
+15
View File
@@ -0,0 +1,15 @@
/* @refresh reload */
import {render} from 'solid-js/web';
// import './index.css';
import {App} from './App';
const root = document.getElementById('root');
if (import.meta.env.DEV && !(root instanceof HTMLElement)) {
throw new Error(
'Root element not found. Did you forget to add it to your index.html? Or maybe the id attribute got mispelled?',
);
}
render(() => <App/>, root!);