Files
Strava-API/src/index.ts
Louis 477d827e6f Initializes Strava API integration
Sets up the basic structure for integrating with the Strava API.
This includes:
- Adds .devcontainer configuration for consistent development environment.
- Configures eslint and prettier for code quality and formatting.
- Implements secure credential management using Infisical.
- Creates basic Strava client and request classes with authentication handling.
- Sets up basic express routes to return data from the Strava API

This commit lays the foundation for future enhancements such as
fetching and displaying activity data.
2025-10-23 16:40:27 +02:00

38 lines
999 B
TypeScript

import express from 'express';
import StravaClient from './clients/strava/StravaClient';
import { Effect } from 'effect'
/**
* Strava API
* Main entry point for the application
*/
const app = express();
const PORT = process.env.PORT || 3000;
app.use(express.json());
const stravaClientEffect = StravaClient.create();
const stravaClient = Effect.runPromise(stravaClientEffect);
// Basic routes
app.get('/', (req: express.Request, res: express.Response) => {
console.log(req)
res.json({ message: 'Strava API' });
});
app.get('/health', (req: express.Request, res: express.Response) => {
console.log(req);
res.json({ status: 'ok' });
});
app.get('/athlete', async (req: express.Request, res: express.Response) => {
console.log(req.baseUrl);
const client = await stravaClient;
const athlete = await Effect.runPromise(client.getAthlete());
res.json(athlete);
});
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});
export default app;