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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ RUN pnpm install --prod

WORKDIR /app/apps/api

EXPOSE 4000
EXPOSE 8080

CMD ["node", "dist/index.js"]
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Now run the server:
pnpm run dev
```

Voila! Your API server is running on `localhost:4000`.
Voila! Your API server is running on `localhost:8080`.
Comment thread
coderabbitai[bot] marked this conversation as resolved.

Now you can access your app at `http://localhost:3000`.

Expand All @@ -208,24 +208,24 @@ docker build -t opensox-api .
3. Run the container with your environment variables:

```bash
docker run -p 4000:4000 \
docker run -p 8080:8080 \
--env-file apps/api/.env \
opensox-api
```

Or if you prefer to pass environment variables individually:

```bash
docker run -p 4000:4000 \
docker run -p 8080:8080 \
-e DATABASE_URL="postgresql://USER:PASSWORD@host.docker.internal:5432/opensox?schema=public" \
-e JWT_SECRET="your-secret" \
-e PORT=4000 \
-e PORT=8080 \
Comment thread
shaurya-shaw marked this conversation as resolved.
opensox-api
```

**Note:** When using Docker, if your database is running on your host machine (not in a container), use `host.docker.internal` instead of `localhost` in your `DATABASE_URL`.

Your API server will be available at `http://localhost:4000`.
Your API server will be available at `http://localhost:8080`.

### Using Docker Compose (Optional)

Expand All @@ -248,11 +248,11 @@ services:
api:
build: .
ports:
- "4000:4000"
- "8080:8080"
environment:
DATABASE_URL: postgresql://opensox:opensox@postgres:5432/opensox?schema=public
JWT_SECRET: your-secret-key
PORT: 4000
PORT: 8080
NODE_ENV: production
depends_on:
- postgres
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { SUBSCRIPTION_STATUS } from "./constants/subscription.js";
dotenv.config();

const app = express();
const PORT = process.env.PORT || 4000;
const PORT = process.env.PORT || 8080;
const CORS_ORIGINS = process.env.CORS_ORIGINS
? process.env.CORS_ORIGINS.split(",")
: ["http://localhost:3000", "http://localhost:5000"];
Expand Down