expanded-api #2

Merged
stephen merged 2 commits from expanded-api into main 2026-01-21 10:18:47 -07:00
3 changed files with 15 additions and 10 deletions
Showing only changes of commit e9b4528dc5 - Show all commits

View File

@ -3,6 +3,9 @@ FROM node:18-alpine
# Set working directory
WORKDIR /app
# Install Curl
RUN apk add --no-cache curl
# Copy package files
COPY package*.json ./

View File

@ -9,8 +9,10 @@ services:
- MONGO_URI=mongodb://admin:password123@mongodb:27017
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.apartment-api.rule=Host(`apartments.maverickapplications.com`) && PathPrefix(`/api`)"
- "traefik.http.routers.apartment-api.entrypoints=websecure"
- "traefik.http.routers.apartment-api.tls=true"
- "traefik.http.routers.apartment-api.tls.certresolver=letsencrypt"
- "traefik.http.routers.apartment-api.priority=100"
- "traefik.http.services.apartment-api.loadbalancer.server.port=8080" # Updated to match

View File

@ -62,7 +62,7 @@ app.get('/health', (req, res) => {
});
// Get daily summary (matches your daily_summaries collection)
app.get('/api/daily-summary', async (req, res) => {
app.get('/daily-summary', async (req, res) => {
try {
const today = getTodayDate();
@ -101,7 +101,7 @@ app.get('/api/daily-summary', async (req, res) => {
});
// Get price history (last 15 days of average prices)
app.get('/api/price-history', async (req, res) => {
app.get('/price-history', async (req, res) => {
try {
const days = parseInt(req.query.days) || 15;
@ -156,7 +156,7 @@ app.get('/api/price-history', async (req, res) => {
});
// Get available units with current prices
app.get('/api/available-units', async (req, res) => {
app.get('/available-units', async (req, res) => {
try {
const today = getTodayDate();
@ -262,7 +262,7 @@ app.get('/api/available-units', async (req, res) => {
});
// Get recent activity (new units, rented units, price changes)
app.get('/api/recent-activity', async (req, res) => {
app.get('/recent-activity', async (req, res) => {
try {
const today = getTodayDate();
const yesterday = getYesterdayDate();
@ -391,7 +391,7 @@ app.get('/api/recent-activity', async (req, res) => {
});
// Get plan statistics
app.get('/api/plan-stats', async (req, res) => {
app.get('/plan-stats', async (req, res) => {
try {
const today = getTodayDate();
@ -472,11 +472,11 @@ async function startServer() {
console.log(`📊 Server listening on 0.0.0.0:${PORT} (accessible from Docker networks)`);
console.log(`📊 Available endpoints:`);
console.log(` GET /health - Health check`);
console.log(` GET /api/daily-summary - Daily apartment summary`);
console.log(` GET /api/price-history - Price trends (15 days)`);
console.log(` GET /api/available-units - Currently available units`);
console.log(` GET /api/recent-activity - Recent market activity`);
console.log(` GET /api/plan-stats - Statistics by floor plan`);
console.log(` GET /daily-summary - Daily apartment summary`);
console.log(` GET /price-history - Price trends (15 days)`);
console.log(` GET /available-units - Currently available units`);
console.log(` GET /recent-activity - Recent market activity`);
console.log(` GET /plan-stats - Statistics by floor plan`);
});
}