cap_feeds_india
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
index.ts
https://thejeshgn--67a0efc03ad411f084059e149126039e.web.val.run
A CORS-enabled HTTP endpoint that fetches and parses the Kerala NDMA (National Disaster Management Authority) RSS feed for weather alerts and disaster warnings.
- ✅ CORS enabled for cross-origin requests
- ✅ Fetches real-time data from Kerala NDMA RSS feed
- ✅ Parses XML and returns structured JSON
- ✅ Error handling with proper HTTP status codes
- ✅ Includes metadata like fetch timestamp and item count
GET /
{ "channel": { "title": "Kerala NDMA RSS Feed", "description": "", "link": "https://sachet.ndma.gov.in/cap_public_website/rss/rss_kerala.xml" }, "items": [ { "title": "Weather alert title", "description": "Alert description (if available)", "link": "Link to detailed alert", "pubDate": "Publication date", "guid": "Unique identifier (if available)" } ], "totalItems": 52, "fetchedAt": "2025-05-27T08:27:27.958Z" }
The API includes the following CORS headers:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Content-Type, Authorization
If the RSS feed is unavailable or there's a parsing error, the API returns:
{ "error": "Failed to fetch RSS feed", "message": "Detailed error message" }
This API fetches data from: https://sachet.ndma.gov.in/cap_public_website/rss/rss_kerala.xml
The RSS feed contains weather alerts, disaster warnings, and emergency notifications for Kerala state in India, published by the National Disaster Management Authority.
fetch('https://your-val-town-url.web.val.run/')
.then(response => response.json())
.then(data => {
console.log(`Found ${data.totalItems} alerts`);
data.items.forEach(item => {
console.log(item.title);
});
});
curl -X GET https://your-val-town-url.web.val.run/
- Built with TypeScript for Val Town
- Simple XML parsing using regex (no external dependencies)
- Handles both CDATA and regular text content
- Supports preflight OPTIONS requests for CORS
- Returns proper HTTP status codes (200 for success, 500 for errors)