mirror of
https://github.com/khairul169/home-lab.git
synced 2025-04-28 08:39:34 +07:00
fix: frontend router not found fix
This commit is contained in:
parent
99c479ade2
commit
4dfa1decfe
@ -1,16 +1,23 @@
|
||||
import "dotenv/config";
|
||||
import { Hono } from "hono";
|
||||
import { cors } from "hono/cors";
|
||||
import fs from "node:fs";
|
||||
import { HTTPException } from "hono/http-exception";
|
||||
import { serveStatic } from "@hono/node-server/serve-static";
|
||||
import { serve } from "@hono/node-server";
|
||||
import routes from "./routes/_routes";
|
||||
import createWsServer from "./websocket";
|
||||
|
||||
const PUBLIC_DIR = "./public";
|
||||
|
||||
const app = new Hono()
|
||||
.use(cors())
|
||||
.use("*", serveStatic({ root: "./public" }))
|
||||
.route("/", routes)
|
||||
.route("/api", routes)
|
||||
.use("*", serveStatic({ root: PUBLIC_DIR }), async (c) => {
|
||||
const index = fs.readFileSync(PUBLIC_DIR + "/index.html", "utf8");
|
||||
c.header("Content-Type", "text/html");
|
||||
return c.html(index);
|
||||
})
|
||||
.onError((err, c) => {
|
||||
if (err instanceof HTTPException) {
|
||||
return err.getResponse();
|
||||
|
File diff suppressed because one or more lines are too long
@ -32,6 +32,6 @@
|
||||
</noscript>
|
||||
<!-- The root element for your Expo app. -->
|
||||
<div id="root"></div>
|
||||
<script src="/_expo/static/js/web/entry-a989ba6dbc16efcaea6aa0b62000b62c.js" defer></script>
|
||||
<script src="/_expo/static/js/web/entry-00f3c2d1c7f748816f9f7bad0e7a55f0.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -38,6 +38,8 @@ const LoginPage = () => {
|
||||
},
|
||||
});
|
||||
|
||||
const onSubmit = form.handleSubmit((val) => login.mutate(val));
|
||||
|
||||
return (
|
||||
<ScrollView
|
||||
contentContainerStyle={cn("flex-1 flex items-center justify-center")}
|
||||
@ -51,6 +53,7 @@ const LoginPage = () => {
|
||||
form={form}
|
||||
path="username"
|
||||
className="mt-6"
|
||||
onSubmitEditing={onSubmit}
|
||||
/>
|
||||
<Input
|
||||
label="Password"
|
||||
@ -58,14 +61,12 @@ const LoginPage = () => {
|
||||
path="password"
|
||||
className="mt-4"
|
||||
secureTextEntry
|
||||
onSubmitEditing={onSubmit}
|
||||
/>
|
||||
|
||||
<Alert className="mt-4" error={login.error} />
|
||||
|
||||
<Button
|
||||
className="mt-8"
|
||||
onPress={form.handleSubmit((val) => login.mutate(val))}
|
||||
>
|
||||
<Button className="mt-8" onPress={onSubmit}>
|
||||
Login
|
||||
</Button>
|
||||
</Box>
|
||||
|
@ -10,7 +10,7 @@ import type {
|
||||
import type { AppType } from "../../backend/routes/_routes";
|
||||
import authStore, { logout } from "@/stores/authStore";
|
||||
|
||||
const api: ReturnType<typeof hono<AppType>> = hc(API_BASEURL, {
|
||||
const api: ReturnType<typeof hono<AppType>> = hc(API_BASEURL + "/api", {
|
||||
fetch: fetchHandler,
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user