[wip] kefir cleanup
This commit is contained in:
@@ -1,33 +1,28 @@
|
||||
import { cors } from "@elysiajs/cors";
|
||||
import { staticPlugin } from "@elysiajs/static";
|
||||
import { Elysia, env } from "elysia";
|
||||
import api from "./api";
|
||||
import staticFiles from "./static";
|
||||
import * as log from "./logging";
|
||||
|
||||
const port = env.PORT || 5001;
|
||||
|
||||
const app = new Elysia()
|
||||
new Elysia()
|
||||
.use(
|
||||
cors({
|
||||
origin: ["http://localhost:3000", "https://games.drm.dev"],
|
||||
origin: [
|
||||
"http://localhost:3000", // dev
|
||||
"https://games.drm.dev", // prod
|
||||
],
|
||||
})
|
||||
)
|
||||
// .onRequest(({ request }) => {
|
||||
// console.log(request.method, request.url);
|
||||
// })
|
||||
.onError(({ error }) => {
|
||||
console.error(error);
|
||||
return error;
|
||||
})
|
||||
|
||||
.onRequest(({ request }) => log.log(request))
|
||||
.onError(({ error }) => log.err(error))
|
||||
|
||||
.get("/ping", () => "pong")
|
||||
.use(api)
|
||||
.get("/*", () => Bun.file("./public/index.html"))
|
||||
.use(
|
||||
staticPlugin({
|
||||
assets: "public",
|
||||
prefix: "/",
|
||||
alwaysStatic: true,
|
||||
})
|
||||
)
|
||||
.use(staticFiles)
|
||||
|
||||
.listen(port);
|
||||
|
||||
console.log("server started on", port);
|
||||
log.log(`server started on ${port}`);
|
||||
|
||||
Reference in New Issue
Block a user