Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -55,3 +56,21 @@ pnpm run test
```
pnpm run dev
```


## Docker setup

```
Install docker <If it isn't installed>
```

## Build the image
```
docker build -t <name> .
```

## Run the image

```
docker run -t -p <port>:3000 --name <container name> express-api-starter-ts:latest
```
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -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}`);
Expand Down