pluviouse commited on
Commit
93db1e3
·
verified ·
1 Parent(s): 42cedcf

Update app.ts

Browse files
Files changed (1) hide show
  1. app.ts +3 -11
app.ts CHANGED
@@ -1,17 +1,9 @@
1
- import { Elysia, t } from "elysia";
 
2
 
3
- const loggerMiddleware = async ({ method, path, headers }, next) => {
4
- console.log(`[${new Date().toISOString()}] ${method} ${path}`);
5
- console.log(`Headers: ${JSON.stringify(headers)}`);
6
- const start = Date.now();
7
- const response = await next();
8
- const duration = Date.now() - start;
9
- console.log(`Response Time: ${duration}ms`);
10
- return response;
11
- };
12
 
13
  const app = new Elysia()
14
- .use(loggerMiddleware)
15
  .get("/", () => "Hello, Elysia!")
16
  .get("/items/:id", ({ params }) => `Item ID: ${params.id}`)
17
  .listen(process.env.PORT);
 
1
+ import { Elysia } from "elysia";
2
+ import { swagger } from "@elysiajs/swagger"
3
 
 
 
 
 
 
 
 
 
 
4
 
5
  const app = new Elysia()
6
+ .use(swagger({ path: "/docs" }))
7
  .get("/", () => "Hello, Elysia!")
8
  .get("/items/:id", ({ params }) => `Item ID: ${params.id}`)
9
  .listen(process.env.PORT);