diff --git a/README.md b/README.md index b0c577e..e715621 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,8 @@ Development utilities: - [supertest](https://www.npmjs.com/package/supertest) - HTTP assertions made easy via superagent. -## Setup +# Setup +## pnpm setup ``` pnpm install @@ -55,3 +56,21 @@ pnpm run test ``` pnpm run dev ``` + + +## Docker setup + +``` +Install docker +``` + +## Build the image +``` +docker build -t . +``` + +## Run the image + +``` + docker run -t -p :3000 --name express-api-starter-ts:latest +``` diff --git a/package.json b/package.json index 548c7a9..6007259 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ "keywords": [], "main": "src/index.ts", "scripts": { - "start": "node --env-file=.env dist/src/index.js", - "dev": "tsx watch --env-file=.env src/index.ts", + "start": "node dist/src/index.js", + "dev": "tsx watch src/index.ts", "build": "tsc", "lint": "eslint --fix src test", "test": "vitest run", diff --git a/src/index.ts b/src/index.ts index acceff8..dc7ef89 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,8 @@ import app from "./app.js"; import { env } from "./env.js"; -const port = env.PORT; +const defaultPort = 3000 +const port = env.PORT || defaultPort; const server = app.listen(port, () => { /* eslint-disable no-console */ console.log(`Listening: http://localhost:${port}`);