Skip to content

Commit

Permalink
add env port
Browse files Browse the repository at this point in the history
  • Loading branch information
maamokun committed Jul 3, 2024
1 parent 533e3a3 commit c112123
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PORT = 80
Binary file modified bun.lockb
Binary file not shown.
35 changes: 18 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"name": "app",
"version": "1.0.50",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "bun run --watch src/index.ts",
"format": "biome format --write .",
"start": "NODE_ENV=production bun run src/index.ts"
},
"dependencies": {
"@biomejs/biome": "^1.8.3",
"@napi-rs/canvas": "^0.1.53",
"elysia": "latest"
},
"devDependencies": {
"bun-types": "latest"
},
"module": "src/index.js"
"name": "app",
"version": "1.0.50",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "bun run --watch src/index.ts",
"format": "biome format --write .",
"start": "NODE_ENV=production bun run src/index.ts"
},
"dependencies": {
"@biomejs/biome": "^1.8.3",
"@napi-rs/canvas": "^0.1.53",
"dotenv": "^16.4.5",
"elysia": "latest"
},
"devDependencies": {
"bun-types": "latest"
},
"module": "src/index.js"
}
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Elysia } from "elysia";
import { createLevel } from "./gen/level";
import "dotenv/config";

const app = new Elysia();

Expand Down Expand Up @@ -44,7 +45,8 @@ app.get("/level", async ({ query, set }) => {
return levelImage;
})

app.listen(80);
const port = process.env.PORT || 80;
app.listen(port);

console.log(
`Server is running on ${app.server?.hostname}:${app.server?.port}`,
Expand Down

0 comments on commit c112123

Please sign in to comment.