|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
import { logger } from "@bogeychan/elysia-logger";
|
|
|
|
|
import { Elysia } from "elysia";
|
|
|
|
|
// import { logger } from "@bogeychan/elysia-logger";
|
|
|
|
|
// import pretty from "pino-pretty";
|
|
|
|
|
import pretty from "pino-pretty";
|
|
|
|
|
import { config } from "../config";
|
|
|
|
|
import { client, db } from "../db";
|
|
|
|
|
import "beth-stack/jsx/register";
|
|
|
|
@ -9,25 +9,25 @@ import { auth } from "../auth";
|
|
|
|
|
|
|
|
|
|
// import { cron } from "@elysiajs/cron";
|
|
|
|
|
|
|
|
|
|
// const stream = pretty({
|
|
|
|
|
// colorize: true,
|
|
|
|
|
// });
|
|
|
|
|
const stream = pretty({
|
|
|
|
|
colorize: true,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const ctx = new Elysia({
|
|
|
|
|
name: "@app/ctx",
|
|
|
|
|
})
|
|
|
|
|
.use(
|
|
|
|
|
bethStack({
|
|
|
|
|
log: true,
|
|
|
|
|
// log: false,
|
|
|
|
|
returnStaleWhileRevalidate: false,
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
// .use(
|
|
|
|
|
// logger({
|
|
|
|
|
// level: config.env.LOG_LEVEL,
|
|
|
|
|
// stream,
|
|
|
|
|
// })
|
|
|
|
|
// )
|
|
|
|
|
.use(
|
|
|
|
|
logger({
|
|
|
|
|
level: config.env.LOG_LEVEL,
|
|
|
|
|
stream,
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
// .use(
|
|
|
|
|
// cron({
|
|
|
|
|
// name: "heartbeat",
|
|
|
|
@ -43,9 +43,9 @@ export const ctx = new Elysia({
|
|
|
|
|
// },
|
|
|
|
|
// })
|
|
|
|
|
// )
|
|
|
|
|
.decorate("db", db)
|
|
|
|
|
.decorate("config", config)
|
|
|
|
|
.decorate("auth", auth);
|
|
|
|
|
// .decorate("db", db)
|
|
|
|
|
// .decorate("config", config)
|
|
|
|
|
// .decorate("auth", auth)
|
|
|
|
|
// .onStart(({ log }) => log.info("Server starting"))
|
|
|
|
|
// .onStop(({ log }) => log.info("Server stopping"))
|
|
|
|
|
// .onRequest(({ log, request }) => {
|
|
|
|
|