FloodApp
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.
This directory contains the server-side code for the Osun State Flood Alert System.
index.ts- Main entry point for the HTTP APIcron.ts- Scheduled job to check for floods and send alertsdatabase/- Database schema and queriesroutes/- API route handlersservices/- Business logic services
POST /api/auth/signup- Create a new user accountPOST /api/auth/login- Log in to an existing accountGET /api/auth/me- Get current user information
GET /api/locations- Get all locations for the current userPOST /api/locations- Add a new locationGET /api/locations/:id- Get a specific locationDELETE /api/locations/:id- Delete a location
POST /api/check-floods- Check for potential floods for a user's locations
The cron.ts file contains a scheduled job that runs daily to:
- Check for pending flood alerts
- Send email notifications to users
- Mark alerts as sent
JWT_SECRET- Secret key for JWT token generation (optional, has default)