API untuk mengakses data Sustainable Development Goals (SDGs) dari seluruh desa di Indonesia
npm installnpm startnpm run start:scheduler
# atau
npm run devServer akan berjalan di http://localhost:5000
GET /api/:kodedesaExample:
curl http://localhost:5000/api/1101010001Response:
{
"status": "success",
"data": [
{
"indikator": "Pendidikan",
"nilai": 75.5,
"image": "/img/..."
}
]
}GET /api/healthPOST /api/trigger-generator
Content-Type: application/json
{
"secret": "your-generator-secret"
}Sistem ini mendukung 2 mode scheduler:
- File:
scheduler.js,index-scheduler.js - Jalankan:
npm run start:scheduler - Schedule: Setiap tanggal 1 bulan, jam 00:00 UTC
- Cocok untuk: Development, self-hosted server
- File:
api/cron.js,vercel.json - Deploy: Ke Vercel
- Schedule: Setiap tanggal 1 bulan, jam 00:00 UTC
- Cocok untuk: Production cloud deployment
api-sdgs/
├── index.js # Plain API server
├── index-scheduler.js # API + local scheduler
├── scheduler.js # Local scheduler logic (node-cron)
├── api/
│ └── cron.js # Vercel cron endpoint
├── generator/
│ ├── index.js # Data generator script
│ ├── package.json
│ └── data/ # Data sources (CSV files)
├── public/
│ ├── index.html # Homepage
│ ├── desa/ # Generated JSON files
│ └── img/ # Images
├── vercel.json # Vercel config
├── package.json
├── CRON_SETUP.md # Vercel Cron documentation
└── SCHEDULER_SETUP.md # Local Scheduler documentation
Create .env file:
PORT=5000
GENERATOR_SECRET=your-secure-secret-key
CRON_SECRET=your-cron-secret- Cron Setup (Vercel) - Cloud deployment dengan Vercel Cron
- Scheduler Setup (Local) - Local scheduler dengan node-cron
- Node.js & Express - Backend API
- node-cron - Local scheduling
- Vercel Cron - Cloud scheduling
- CSV & JSON - Data processing
- Tailwind CSS - Frontend styling
✅ Data SDGs dari seluruh desa Indonesia
✅ Update otomatis setiap bulan
✅ REST API sederhana
✅ JSON response format
✅ No authentication required
✅ CORS enabled
✅ Dual scheduler (local + cloud)
Contributions are welcome! Please feel free to submit a Pull Request.
ISC
- Email: info@opendesa.id
- Website: opendesa.id
- GitHub: andifahruddinakas/api-sdgs
Made with ❤️ by OpenDesa