Table of Contents
Introduction
A simple Express.js application that integrates with the Google Fit API to fetch and aggregate fitness data. This app uses Google OAuth2 for authentication and Appwrite for additional backend functionality.
Features
- Authenticate users with Google OAuth2
- Fetch fitness data from Google Fit API
- Aggregate various fitness metrics such as step count, blood glucose, heart rate, weight, height, sleep hours, and body fat percentage
- Serve static files and a basic HTML interface
Endpoints
-
GET /auth/google
Generates and returns the Google OAuth2 authentication URL.
-
GET /auth/google/callback
Handles the OAuth2 callback, exchanges the authorization code for tokens, and retrieves user profile data.
-
GET /fetch-data
Fetches and aggregates fitness data from the Google Fit API and returns it as a JSON response.
-
GET /
Serves a static
index.html
file.
Usage
- Visit
http://localhost:3000/
to access the application. - Navigate to
/auth/google
to initiate the Google authentication process. - After successful authentication, the application will redirect to
/fetch-data
to display the aggregated fitness data.
Debugging
Check the console logs for debugging information, including raw API responses and user profile data.