Skip to content

sarp159/proxy-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yandex Maps Proxy Server

CORS sorununu çözmek için backend proxy server.

Kurulum

cd proxy-server
npm install

Çalıştırma

npm start

Veya development mode (auto-reload):

npm run dev

Server http://localhost:3001 adresinde çalışacak.

API Endpoints

1. Suggest API (Autocomplete)

GET http://localhost:3001/api/suggest?q=istanbul

Response:

{
  "results": [
    {
      "title": { "text": "İstanbul, Türkiye" },
      ...
    }
  ]
}

2. Geocode API (Adres → Koordinat)

GET http://localhost:3001/api/geocode?address=Taksim Meydanı İstanbul

Response:

{
  "lat": 41.036987,
  "lon": 28.985033
}

Frontend Entegrasyonu

js/maps.js dosyasında API URL'lerini değiştirin:

// Eski (CORS hatası)
const url = `https://suggest-maps.yandex.ru/v1/suggest?...`;

// Yeni (Proxy üzerinden)
const url = `http://localhost:3001/api/suggest?q=${query}`;

Production

Production'da:

  1. Proxy server'ı ayrı bir sunucuda çalıştırın
  2. Environment variable ile API key'i yönetin
  3. Rate limiting ekleyin
  4. HTTPS kullanın

Notlar

  • ✅ CORS sorunu çözüldü
  • ✅ API key güvende (backend'de)
  • ✅ Autocomplete çalışıyor
  • ⚠️ Development için localhost:3001 kullanılıyor

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors