|
|
|
@ -1,9 +1,9 @@
|
|
|
|
|
import { Elysia } from "elysia";
|
|
|
|
|
import { logger } from "@bogeychan/elysia-logger";
|
|
|
|
|
import pretty from "pino-pretty";
|
|
|
|
|
import { html } from "@elysiajs/html";
|
|
|
|
|
import { config } from "../config";
|
|
|
|
|
import { db } from "../model/store";
|
|
|
|
|
import "@kitajs/html/htmx";
|
|
|
|
|
|
|
|
|
|
const stream = pretty({
|
|
|
|
|
colorize: true,
|
|
|
|
@ -18,17 +18,16 @@ export const ctx = new Elysia({
|
|
|
|
|
stream,
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
.use(html())
|
|
|
|
|
.decorate("db", db)
|
|
|
|
|
.decorate("config", config)
|
|
|
|
|
// .onStart(({ log }) => log.info("Server starting"))
|
|
|
|
|
// .onStop(({ log }) => log.info("Server stopping"))
|
|
|
|
|
.onRequest(({ log, request }) =>
|
|
|
|
|
log.debug(`Request received: ${request.method}: ${request.url}`)
|
|
|
|
|
)
|
|
|
|
|
.onResponse(({ log, request, set }) =>
|
|
|
|
|
log.debug(
|
|
|
|
|
`Response sent: ${request.method}: ${request.url} with status ${set.status}`
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
.decorate("config", config);
|
|
|
|
|
// .onStart(({ log }) => log.info("Server starting"))
|
|
|
|
|
// .onStop(({ log }) => log.info("Server stopping"))
|
|
|
|
|
// .onRequest(({ log, request }) => {
|
|
|
|
|
// log.debug(`Request received: ${request.method}: ${request.url}`);
|
|
|
|
|
// });
|
|
|
|
|
// .onResponse(({ log, request, set }) => {
|
|
|
|
|
// log.debug(
|
|
|
|
|
// `Response sent: ${request.method}: ${request.url} with status ${set.status}`
|
|
|
|
|
// );
|
|
|
|
|
// });
|
|
|
|
|
// .onError(({ log, error }) => log.error(error));
|
|
|
|
|