CORS sorununu çözmek için backend proxy server.
cd proxy-server
npm installnpm startVeya development mode (auto-reload):
npm run devServer http://localhost:3001 adresinde çalışacak.
GET http://localhost:3001/api/suggest?q=istanbul
Response:
{
"results": [
{
"title": { "text": "İstanbul, Türkiye" },
...
}
]
}GET http://localhost:3001/api/geocode?address=Taksim Meydanı İstanbul
Response:
{
"lat": 41.036987,
"lon": 28.985033
}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'da:
- Proxy server'ı ayrı bir sunucuda çalıştırın
- Environment variable ile API key'i yönetin
- Rate limiting ekleyin
- HTTPS kullanın
- ✅ CORS sorunu çözüldü
- ✅ API key güvende (backend'de)
- ✅ Autocomplete çalışıyor
⚠️ Development için localhost:3001 kullanılıyor