Skip to content

fix: replace hardcoded localhost URLs with NEXT_PUBLIC_API_URL #24

Open
pericharlabindhumadhavi-data wants to merge 1 commit into
Pushkarini579:mainfrom
pericharlabindhumadhavi-data:fix/issue-17-api-url
Open

fix: replace hardcoded localhost URLs with NEXT_PUBLIC_API_URL #24
pericharlabindhumadhavi-data wants to merge 1 commit into
Pushkarini579:mainfrom
pericharlabindhumadhavi-data:fix/issue-17-api-url

Conversation

@pericharlabindhumadhavi-data

Copy link
Copy Markdown

Closes #17

Problem

The login and signup pages were hardcoding the backend URL:

  • http://localhost:5000/api/auth/login
  • http://localhost:5000/api/auth/signup

This causes silent failures in any deployed environment because localhost:5000 only exists on the developer's machine. Meanwhile the upload page was already correctly using process.env.NEXT_PUBLIC_API_URL — making the behavior inconsistent across the app.

Fix

Replaced hardcoded URLs in both auth pages with the same environment-variable pattern used by the upload page:

const apiUrl = process.env.NEXT_PUBLIC_API_URL || "http://localhost:5000";

This ensures:

  • Works in development (falls back to localhost)
  • Works in production (uses the environment variable)
  • Consistent with upload page behavior

Files Changed

  • src/app/auth/login/page.tsx
  • src/app/auth/signup/page.tsx

Testing

  • Verified the apiUrl variable is present in both files
  • Behavior in development is unchanged (falls back to localhost:5000)
  • In production, setting NEXT_PUBLIC_API_URL will now correctly route auth requests

@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

@pericharlabindhumadhavi-data is attempting to deploy a commit to the Pushkarini 's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Auth pages hardcode localhost:5000 instead of using NEXT_PUBLIC_API_URL

1 participant