Skip to content

Commit

Permalink
Update Elysia package to v1
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbrianevans committed May 25, 2024
1 parent f43b464 commit 75c5129
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 4 deletions.
8 changes: 6 additions & 2 deletions server/Api.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ RUN bun install --omit=dev

COPY . .

RUN bun build --compile --minify --sourcemap --target=bun-linux-x64-modern ./src/api/server.ts --outfile apiServer
# RUN bun build --compile --minify --sourcemap --target=bun-linux-x64-modern ./src/api/server.ts --outfile apiServer

EXPOSE 3000

CMD ./apiServer
# instead of building to a binary, I'm running with bun runtime since there was a bug introduced by compiling.
# started getting "Right side of assignment cannot be destructured" when compiled to binary executable.
CMD bun ./src/api/server.ts

# CMD ./apiServer

#FROM alpine
#
Expand Down
Binary file modified server/bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions server/dist/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"typescript": "^5.4.5"
},
"dependencies": {
"elysia": "0.7.12",
"elysia": "1.0.22",
"genson-js": "^0.0.8",
"pino": "^8.21.0",
"redis": "^4.6.13"
Expand Down
2 changes: 2 additions & 0 deletions server/src/api/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { redisClient } from "../utils/getRedisClient"
import { setTimeout } from "node:timers/promises"

const app = new Elysia()
.on('error', (err)=>console.error('Error', err.request.url, err.error.message))
.use(healthCheckRouter)
.use(miscRouter)
.use(eventHistoryRouter)
Expand Down Expand Up @@ -46,6 +47,7 @@ async function shutdown() {
}
}

//TODO: this doesn't work at present. taking 11 seconds to restart docker container
process.on("SIGINT", shutdown) // quit on ctrl-c when running docker in terminal
process.on("SIGTERM", shutdown)// quit properly on docker stop

Expand Down
2 changes: 1 addition & 1 deletion server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"target": "esnext",
"moduleResolution": "bundler",
"outDir": "dist",
"noEmit": false,
"noEmit": true,
"allowImportingTsExtensions": false,
"moduleDetection": "force",
"allowJs": true,
Expand Down

0 comments on commit 75c5129

Please sign in to comment.