File tree Expand file tree Collapse file tree 5 files changed +65
-296
lines changed
Expand file tree Collapse file tree 5 files changed +65
-296
lines changed Original file line number Diff line number Diff line change 66 "." : " ./src/index.ts"
77 },
88 "scripts" : {
9- "test" : " echo \" Error: no test specified\" && exit 1" ,
109 "dev" : " bun run --watch src/index.ts" ,
11- "check" : " tsc --noEmit"
10+ "check" : " tsc --noEmit" ,
11+ "db:migrate" : " drizzle-kit migrate"
1212 },
1313 "dependencies" : {
14+ "@bogeychan/elysia-logger" : " ^0.1.10" ,
15+ "@elysiajs/cors" : " ^1.4.0" ,
1416 "@elysiajs/jwt" : " ^1.4.0" ,
1517 "@sinclair/typebox" : " ^0.34.41" ,
1618 "drizzle-orm" : " ^0.45.0" ,
1719 "elysia" : " ^1.4.18" ,
18- "postgres" : " ^3.4.7"
20+ "postgres" : " ^3.4.7" ,
21+ "valibot" : " ^1.2.0"
1922 },
2023 "devDependencies" : {
2124 "bun-types" : " latest" ,
Original file line number Diff line number Diff line change 1+ import { cors } from "@elysiajs/cors" ;
12import { Elysia } from "elysia" ;
23import { authRoutes } from "./domains/auth/routes.ts" ;
34import { channelRoutes } from "./domains/channels/routes.ts" ;
@@ -8,9 +9,13 @@ import { organizationRoutes } from "./domains/organizations/routes.ts";
89import { taskRoutes } from "./domains/tasks/routes.ts" ;
910import { userRoutes } from "./domains/users/routes.ts" ;
1011import { voteRoutes } from "./domains/votes/routes.ts" ;
12+ import { env } from "./env.ts" ;
13+ import { loggerMiddleware } from "./middleware/logger.ts" ;
1114import { wsRoutes } from "./ws/index.ts" ;
1215
1316const app = new Elysia ( )
17+ . use ( loggerMiddleware )
18+ . use ( cors ( { origin : env . CORS_ORIGIN , credentials : true } ) )
1419 . get ( "/" , ( ) => ( { message : "Prism API Server" } ) )
1520 . get ( "/health" , ( ) => ( { status : "ok" , timestamp : Date . now ( ) } ) )
1621 . use ( authRoutes )
@@ -23,7 +28,7 @@ const app = new Elysia()
2328 . use ( taskRoutes )
2429 . use ( voteRoutes )
2530 . use ( wsRoutes )
26- . listen ( 3000 ) ;
31+ . listen ( env . PORT ) ;
2732
2833console . log (
2934 `🦊 Elysia is running at ${ app . server ?. hostname } :${ app . server ?. port } ` ,
Original file line number Diff line number Diff line change 1+ import { logger } from "@bogeychan/elysia-logger" ;
2+
3+ export const loggerMiddleware = logger ( {
4+ level : process . env . NODE_ENV === "production" ? "info" : "debug" ,
5+ autoLogging : {
6+ ignore ( ctx ) {
7+ return ctx . path === "/health" ;
8+ } ,
9+ } ,
10+ } ) ;
You can’t perform that action at this time.
0 commit comments