chore: update port configuration to avoid conflicts

Port Configuration:
- Backend: 8521 (was 8080/8158)
- Frontend: 8963 (was 3000)

Files updated:
- backend/.env.example: updated PORT and CORS_ORIGINS
- frontend/src/lib/auth.ts: API_URL default to 8521
- frontend/src/lib/api.ts: API_URL default to 8521
- frontend/src/lib/storage.ts: API_URL default to 8521
- run_dev.sh: added port flags and service info display

Usage:
  ./run_dev.sh
  # Backend:  http://localhost:8521
  # Frontend: http://localhost:8963
This commit is contained in:
Tiago Yamamoto 2025-12-11 17:06:37 -03:00
parent 9291b06db5
commit 18ac6d74f0
9 changed files with 99 additions and 13 deletions

View file

@ -19,12 +19,12 @@ S3_BUCKET=your-bucket-name
JWT_SECRET=your-secret-key-change-this-in-production-use-strong-random-value
# Server Configuration
PORT=8080
PORT=8521
ENV=development
# CORS Origins (comma-separated)
CORS_ORIGINS=http://localhost:3000
CORS_ORIGINS=http://localhost:8963
# File Upload
MAX_UPLOAD_SIZE=10485760 # 10MB in bytes
MAX_UPLOAD_SIZE=10485760
UPLOAD_DIR=./uploads

View file

@ -62,6 +62,36 @@ const docTemplate = `{
}
},
"/api/v1/companies": {
"get": {
"description": "Returns a list of all companies.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Companies"
],
"summary": "List Companies",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.CompanyResponse"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"post": {
"description": "Registers a new company and creates an initial admin user.",
"consumes": [

View file

@ -56,6 +56,36 @@
}
},
"/api/v1/companies": {
"get": {
"description": "Returns a list of all companies.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Companies"
],
"summary": "List Companies",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.CompanyResponse"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"post": {
"description": "Registers a new company and creates an initial admin user.",
"consumes": [

View file

@ -106,6 +106,26 @@ paths:
tags:
- Auth
/api/v1/companies:
get:
consumes:
- application/json
description: Returns a list of all companies.
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.CompanyResponse'
type: array
"500":
description: Internal Server Error
schema:
type: string
summary: List Companies
tags:
- Companies
post:
consumes:
- application/json

View file

@ -3,6 +3,10 @@ module github.com/rede5/gohorsejobs/backend
go 1.24.0
require (
github.com/aws/aws-sdk-go-v2 v1.41.0
github.com/aws/aws-sdk-go-v2/config v1.32.5
github.com/aws/aws-sdk-go-v2/credentials v1.19.5
github.com/aws/aws-sdk-go-v2/service/s3 v1.93.2
github.com/golang-jwt/jwt/v5 v5.3.0
github.com/google/uuid v1.6.0
github.com/joho/godotenv v1.5.1
@ -14,10 +18,7 @@ require (
require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/aws/aws-sdk-go-v2 v1.41.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 // indirect
github.com/aws/aws-sdk-go-v2/config v1.32.5 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.19.5 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.16 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.16 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.16 // indirect
@ -27,7 +28,6 @@ require (
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.7 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.16 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.16 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.93.2 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.0.4 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.30.7 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.12 // indirect

View file

@ -1,6 +1,6 @@
import { getToken } from "./auth";
const API_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8080";
const API_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8521";
export interface ApiUser {
id: string;

View file

@ -1,7 +1,7 @@
import type { User } from "./types";
const AUTH_KEY = "job-portal-auth";
const API_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8080/api/v1";
const API_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8521/api/v1";
interface LoginResponse {
token: string;

View file

@ -2,7 +2,7 @@
* Storage service for S3 file uploads via pre-signed URLs
*/
const API_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8080/api/v1";
const API_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8521/api/v1";
interface UploadUrlResponse {
uploadUrl: string;

View file

@ -38,7 +38,7 @@ if [ ! -d "frontend/node_modules" ]; then
fi
# Start Backend
echo "🔹 Starting Backend (Go)..."
echo "🔹 Starting Backend (Go) on port 8521..."
(cd backend && go run cmd/api/main.go) &
BACKEND_PID=$!
@ -46,9 +46,15 @@ BACKEND_PID=$!
sleep 2
# Start Frontend
echo "🔹 Starting Frontend (Next.js)..."
(cd frontend && npm run dev) &
echo "🔹 Starting Frontend (Next.js) on port 8963..."
(cd frontend && npm run dev -- -p 8963) &
FRONTEND_PID=$!
echo ""
echo "📡 Services running:"
echo " - Backend: http://localhost:8521"
echo " - Frontend: http://localhost:8963"
echo ""
# Wait for both processes
wait $BACKEND_PID $FRONTEND_PID