Task name: User endpoints
Requirements
1. We need to create CRUD endpoints
2. The entries (users) can just be saved in a noSQL database (Bonus for using Firebase Realtime Database)
3. Each user should have the following data entries:
id, name, zip code, latitude, longitude, timezone
4. When creating a user, allow input for name and zip code.
(Fetch the latitude, longitude, and timezone - Documentation: https://openweathermap.org/current)
5. When updating a user, Re-fetch the latitude, longitude, and timezone (if zip code changes)
6. Connect to a ReactJS front-end
- feel free to add add something creative you'd like
API Key: 7afa46f2e91768e7eeeb9001ce40de19
- Node.js (v16 or higher)
- npm or yarn
- Firebase account and project
- OpenWeather API key
- Clone the repository and install dependencies:
# install server dependencies
npm install
# install client dependencies
cd client
npm install
cd ..- Create a
.envfile in the root directory:
OPENWEATHER_API_KEY=your_openweather_api_key_here- Set up Firebase configuration:
- Create a Firebase project at https://console.firebase.google.com
- Enable Realtime Database
- Download your Firebase config and add to
src/config/firebase.ts
- From root directory:
npm run dev:allThe server will start on http://localhost:3000
- From the app root directory run:
# initiate app
firebase init
# when ready, deploy app
firebase deploy- Using
get()vs a listener: https://firebase.google.com/docs/database/web/read-and-write - Pagination done differently?: https://firebase.google.com/docs/database/web/lists-of-data#limit_the_number_of_results
- UI needs some love
- Client-side zip code validation, debounced submissions, loading skeletons
- Automatic retries with exponential backoff, retry buttons, geocoding cache
- Better error logging and monitoring
- Input validation middleware?