meti-frontend/BACKEND_CONFIG.md
Aditya Siregar 4ebe6da793 Update .env
2025-08-15 23:16:19 +07:00

1.6 KiB

Backend Configuration

Quick Setup

If you're having issues with environment variables, you can modify the backend URL directly in the code:

1. Edit lib/config.ts

Find this line in the file:

const BACKEND_URL = 'https://evoting-be.apskel.org' // Change this to your backend URL

Change it to your actual backend URL, for example:

const BACKEND_URL = 'http://localhost:4002' // Your backend URL

2. Set Auth Header

Also find this line:

const AUTH_HEADER = '••••••' // Change this to your actual auth header

Change it to your actual authorization header value.

3. Restart the Application

After making changes, restart your Next.js development server:

npm run dev

Current Configuration

The application is currently configured to call:

  • Login URL: https://evoting-be.apskel.org/api/v1/auth/login
  • Auth Header: ••••••

Debug Information

Check your browser's console (F12 → Console) to see:

  • What URL is being called
  • Whether the auth header is set
  • The response from the backend

Alternative: Environment Variables

If you prefer to use environment variables, create a .env.local file in the root directory:

NEXT_PUBLIC_API_BASE_URL=http://localhost:4002
NEXT_PUBLIC_API_AUTH_HEADER=your_actual_auth_header

Testing

Use this curl command to test your backend:

curl --location 'http://localhost:4002/api/v1/auth/login' \
--header 'Content-Type: application/json' \
--header 'Authorization: your_actual_auth_header' \
--data-raw '{
    "email": "superadmin@example.com",
    "password": "ChangeMe!Super#123"
}'