better logging
This commit is contained in:
@@ -12,6 +12,7 @@ const api = new Elysia({ prefix: "/api" })
|
|||||||
});
|
});
|
||||||
token.value = newHuman.key;
|
token.value = newHuman.key;
|
||||||
}
|
}
|
||||||
|
return token.value;
|
||||||
})
|
})
|
||||||
.use(human)
|
.use(human)
|
||||||
.post(
|
.post(
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import api from "./api";
|
|||||||
import { Elysia, env } from "elysia";
|
import { Elysia, env } from "elysia";
|
||||||
import { cors } from "@elysiajs/cors";
|
import { cors } from "@elysiajs/cors";
|
||||||
import { staticPlugin } from "@elysiajs/static";
|
import { staticPlugin } from "@elysiajs/static";
|
||||||
|
import { error } from "node:console";
|
||||||
|
|
||||||
const port = env.PORT || 5001;
|
const port = env.PORT || 5001;
|
||||||
|
|
||||||
@@ -14,6 +15,10 @@ const app = new Elysia()
|
|||||||
.onRequest(({ request }) => {
|
.onRequest(({ request }) => {
|
||||||
console.log(request.method, request.url);
|
console.log(request.method, request.url);
|
||||||
})
|
})
|
||||||
|
.onError(({ error }) => {
|
||||||
|
console.error(error);
|
||||||
|
return error;
|
||||||
|
})
|
||||||
.get("/ping", () => "pong")
|
.get("/ping", () => "pong")
|
||||||
.use(api)
|
.use(api)
|
||||||
.get("/*", () => Bun.file("./public/index.html"))
|
.get("/*", () => Bun.file("./public/index.html"))
|
||||||
|
|||||||
Reference in New Issue
Block a user