1.1.3 • Published 1 year ago
pxsty.earthquakes v1.1.3
pxsty.earthquakes
pxsty.earthquakes, AFAD (Afet ve Acil Durum Yönetimi Başkanlığı) web sitesinden son depremleri çekmek için geliştirilmiş bir Node.js kütüphanesidir.
Kütüphaneyi, depremin 2. yılını anarken yeniliyorum. Vefat eden herkese Allah'tan rahmet, yaralanan herkese şifalar diliyorum. Ülkemiz için böyle acı dolu anların bir daha yaşanmaması dileğiyle.
Kurulum
npm install pxsty.earthquakesveya
yarn add pxsty.earthquakesKullanım
TypeScript Örneği
import EarthquakeAPI from "pxsty.earthquakes";
const fetchEarthquakes = async () => {
const response = await EarthquakeAPI.getAllEarthquakes();
if (response.type === "SUCCESS") {
console.log("Depremler:", response.data);
} else {
console.error("Veri çekme hatası!");
}
};
fetchEarthquakes();JavaScript Örneği
const EarthquakeAPI = require("pxsty.earthquakes").default;
async function fetchEarthquakes() {
const response = await EarthquakeAPI.getAllEarthquakes();
if (response.type === "SUCCESS") {
console.log("Depremler:", response.data);
} else {
console.error("Veri çekme hatası!");
}
}
fetchEarthquakes();Dönen Veri Formatı
Başarılı bir istek aşağıdaki formatta bir dizi deprem verisi döndürür:
{
"type": "SUCCESS",
"data": [
{
"date": "2024-02-06 12:34:56",
"latitude": 38.9637,
"longitude": 35.2433,
"depth": 10.2,
"type": "ML",
"size": 4.5,
"place": "Ankara, Türkiye"
}
]
}Eğer hata oluşursa:
{
"type": "ERROR",
"data": []
}Desteklenen Magnitüd Türleri
ML: Yerel magnitüdMW: Moment magnitüdü
Lisans
MIT Lisansı altında sunulmaktadır.