- Updated all component headers and documentation
- Changed navbar and footer branding
- Updated homepage hero badge
- Modified page title in index.html
- Simplified footer text to 'Built with ❤️'
- Consistent V2 capitalization across all references
349 lines
12 KiB
JavaScript
349 lines
12 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const express_1 = require("express");
|
|
const router = (0, express_1.Router)();
|
|
const apiDocumentation = {
|
|
name: 'Redirect Intelligence v2 API',
|
|
version: '2.0.0',
|
|
description: 'Professional redirect tracking and analysis API',
|
|
baseUrl: process.env.NODE_ENV === 'production' ? 'https://api.urltrackertool.com' : 'http://localhost:3333',
|
|
endpoints: {
|
|
health: {
|
|
method: 'GET',
|
|
path: '/health',
|
|
description: 'API health check',
|
|
response: {
|
|
status: 'ok',
|
|
timestamp: '2025-08-19T12:53:08.946Z',
|
|
version: '2.0.0',
|
|
environment: 'production'
|
|
}
|
|
},
|
|
auth: {
|
|
login: {
|
|
method: 'POST',
|
|
path: '/api/v1/auth/login',
|
|
description: 'User authentication',
|
|
body: {
|
|
email: 'user@example.com',
|
|
password: 'password'
|
|
}
|
|
},
|
|
register: {
|
|
method: 'POST',
|
|
path: '/api/v1/auth/register',
|
|
description: 'User registration',
|
|
body: {
|
|
email: 'user@example.com',
|
|
name: 'User Name',
|
|
password: 'password',
|
|
organizationName: 'My Organization'
|
|
}
|
|
}
|
|
},
|
|
tracking: {
|
|
trackV2: {
|
|
method: 'POST',
|
|
path: '/api/v2/track',
|
|
description: 'Enhanced URL tracking with analysis',
|
|
body: {
|
|
url: 'https://example.com',
|
|
method: 'GET',
|
|
enableSSLAnalysis: true,
|
|
enableSEOAnalysis: true,
|
|
enableSecurityAnalysis: true,
|
|
maxHops: 10,
|
|
timeout: 15000
|
|
}
|
|
},
|
|
trackLegacy: {
|
|
method: 'POST',
|
|
path: '/api/v1/track',
|
|
description: 'Legacy URL tracking (backward compatibility)',
|
|
body: {
|
|
url: 'https://example.com',
|
|
method: 'GET',
|
|
userAgent: 'RedirectTracker/2.0'
|
|
}
|
|
},
|
|
getCheck: {
|
|
method: 'GET',
|
|
path: '/api/v2/track/:checkId',
|
|
description: 'Get tracking check results by ID'
|
|
}
|
|
},
|
|
analysis: {
|
|
ssl: {
|
|
method: 'POST',
|
|
path: '/api/v2/analyze/ssl',
|
|
description: 'SSL certificate analysis',
|
|
body: { url: 'https://example.com' }
|
|
},
|
|
seo: {
|
|
method: 'POST',
|
|
path: '/api/v2/analyze/seo',
|
|
description: 'SEO analysis',
|
|
body: { url: 'https://example.com' }
|
|
},
|
|
security: {
|
|
method: 'POST',
|
|
path: '/api/v2/analyze/security',
|
|
description: 'Security analysis',
|
|
body: { url: 'https://example.com' }
|
|
},
|
|
comprehensive: {
|
|
method: 'POST',
|
|
path: '/api/v2/analyze/comprehensive',
|
|
description: 'Comprehensive analysis (SSL + SEO + Security)',
|
|
body: { url: 'https://example.com' }
|
|
}
|
|
},
|
|
export: {
|
|
markdown: {
|
|
method: 'GET',
|
|
path: '/api/v2/export/:checkId/markdown',
|
|
description: 'Export check results as Markdown'
|
|
},
|
|
pdf: {
|
|
method: 'GET',
|
|
path: '/api/v2/export/:checkId/pdf',
|
|
description: 'Export check results as PDF'
|
|
}
|
|
},
|
|
bulk: {
|
|
upload: {
|
|
method: 'POST',
|
|
path: '/api/v2/bulk/upload',
|
|
description: 'Upload CSV file for bulk URL tracking',
|
|
contentType: 'multipart/form-data',
|
|
body: 'CSV file with url,method,userAgent columns'
|
|
},
|
|
jobs: {
|
|
method: 'GET',
|
|
path: '/api/v2/bulk/jobs',
|
|
description: 'List bulk tracking jobs'
|
|
}
|
|
}
|
|
},
|
|
rateLimit: {
|
|
anonymous: '50 requests per hour',
|
|
authenticated: '1000 requests per hour'
|
|
},
|
|
authentication: {
|
|
type: 'JWT (HttpOnly Cookies)',
|
|
loginRequired: [
|
|
'/api/v2/track (enhanced features)',
|
|
'/api/v2/bulk/*',
|
|
'/api/v2/export/*',
|
|
'/api/v1/auth/me'
|
|
]
|
|
}
|
|
};
|
|
router.get('/docs', (req, res) => {
|
|
const htmlDoc = `
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Redirect Intelligence v2 API Documentation</title>
|
|
<style>
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
line-height: 1.6;
|
|
color: #333;
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
}
|
|
.container {
|
|
background: white;
|
|
border-radius: 12px;
|
|
padding: 40px;
|
|
box-shadow: 0 20px 40px rgba(0,0,0,0.1);
|
|
}
|
|
h1 { color: #2d3748; margin-bottom: 10px; }
|
|
h2 { color: #4a5568; border-bottom: 2px solid #e2e8f0; padding-bottom: 10px; }
|
|
h3 { color: #5a67d8; }
|
|
.endpoint {
|
|
background: #f7fafc;
|
|
border-left: 4px solid #5a67d8;
|
|
padding: 15px;
|
|
margin: 10px 0;
|
|
border-radius: 0 8px 8px 0;
|
|
}
|
|
.method {
|
|
display: inline-block;
|
|
padding: 4px 8px;
|
|
border-radius: 4px;
|
|
font-weight: bold;
|
|
color: white;
|
|
font-size: 12px;
|
|
}
|
|
.get { background: #48bb78; }
|
|
.post { background: #ed8936; }
|
|
.put { background: #4299e1; }
|
|
.delete { background: #f56565; }
|
|
code {
|
|
background: #edf2f7;
|
|
padding: 2px 6px;
|
|
border-radius: 4px;
|
|
font-family: 'Monaco', 'Consolas', monospace;
|
|
}
|
|
pre {
|
|
background: #1a202c;
|
|
color: #e2e8f0;
|
|
padding: 15px;
|
|
border-radius: 8px;
|
|
overflow-x: auto;
|
|
}
|
|
.badge {
|
|
background: #5a67d8;
|
|
color: white;
|
|
padding: 4px 12px;
|
|
border-radius: 20px;
|
|
font-size: 14px;
|
|
display: inline-block;
|
|
margin: 4px;
|
|
}
|
|
.live-status {
|
|
background: #48bb78;
|
|
color: white;
|
|
padding: 8px 16px;
|
|
border-radius: 20px;
|
|
display: inline-block;
|
|
margin-bottom: 20px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="live-status">🟢 API Status: Live & Operational</div>
|
|
|
|
<h1>🔗 ${apiDocumentation.name}</h1>
|
|
<p><strong>Version:</strong> ${apiDocumentation.version}</p>
|
|
<p><strong>Base URL:</strong> <code>${apiDocumentation.baseUrl}</code></p>
|
|
<p>${apiDocumentation.description}</p>
|
|
|
|
<h2>🏥 Health Check</h2>
|
|
<div class="endpoint">
|
|
<span class="method get">GET</span> <code>/health</code>
|
|
<p>Check API health and status</p>
|
|
<pre>${JSON.stringify(apiDocumentation.endpoints.health.response, null, 2)}</pre>
|
|
</div>
|
|
|
|
<h2>🔐 Authentication</h2>
|
|
<p><strong>Type:</strong> ${apiDocumentation.authentication.type}</p>
|
|
|
|
<div class="endpoint">
|
|
<span class="method post">POST</span> <code>/api/v1/auth/login</code>
|
|
<p>User authentication</p>
|
|
<pre>${JSON.stringify(apiDocumentation.endpoints.auth.login.body, null, 2)}</pre>
|
|
</div>
|
|
|
|
<div class="endpoint">
|
|
<span class="method post">POST</span> <code>/api/v1/auth/register</code>
|
|
<p>User registration</p>
|
|
<pre>${JSON.stringify(apiDocumentation.endpoints.auth.register.body, null, 2)}</pre>
|
|
</div>
|
|
|
|
<h2>🔍 URL Tracking</h2>
|
|
|
|
<div class="endpoint">
|
|
<span class="method post">POST</span> <code>/api/v2/track</code>
|
|
<span class="badge">Enhanced v2</span>
|
|
<p>Advanced URL tracking with SSL, SEO, and Security analysis</p>
|
|
<pre>${JSON.stringify(apiDocumentation.endpoints.tracking.trackV2.body, null, 2)}</pre>
|
|
</div>
|
|
|
|
<div class="endpoint">
|
|
<span class="method post">POST</span> <code>/api/v1/track</code>
|
|
<span class="badge">Legacy</span>
|
|
<p>Basic URL tracking (backward compatibility)</p>
|
|
<pre>${JSON.stringify(apiDocumentation.endpoints.tracking.trackLegacy.body, null, 2)}</pre>
|
|
</div>
|
|
|
|
<div class="endpoint">
|
|
<span class="method get">GET</span> <code>/api/v2/track/:checkId</code>
|
|
<p>Get tracking results by check ID</p>
|
|
</div>
|
|
|
|
<h2>📊 Analysis</h2>
|
|
|
|
<div class="endpoint">
|
|
<span class="method post">POST</span> <code>/api/v2/analyze/comprehensive</code>
|
|
<p>Complete analysis (SSL + SEO + Security)</p>
|
|
<pre>${JSON.stringify(apiDocumentation.endpoints.analysis.comprehensive.body, null, 2)}</pre>
|
|
</div>
|
|
|
|
<div class="endpoint">
|
|
<span class="method post">POST</span> <code>/api/v2/analyze/ssl</code>
|
|
<p>SSL certificate analysis only</p>
|
|
</div>
|
|
|
|
<div class="endpoint">
|
|
<span class="method post">POST</span> <code>/api/v2/analyze/seo</code>
|
|
<p>SEO analysis only</p>
|
|
</div>
|
|
|
|
<div class="endpoint">
|
|
<span class="method post">POST</span> <code>/api/v2/analyze/security</code>
|
|
<p>Security analysis only</p>
|
|
</div>
|
|
|
|
<h2>📤 Bulk Processing</h2>
|
|
|
|
<div class="endpoint">
|
|
<span class="method post">POST</span> <code>/api/v2/bulk/upload</code>
|
|
<span class="badge">Auth Required</span>
|
|
<p>Upload CSV file for bulk URL tracking</p>
|
|
<p><strong>Content-Type:</strong> multipart/form-data</p>
|
|
<p><strong>File Format:</strong> CSV with columns: url, method, userAgent</p>
|
|
</div>
|
|
|
|
<div class="endpoint">
|
|
<span class="method get">GET</span> <code>/api/v2/bulk/jobs</code>
|
|
<span class="badge">Auth Required</span>
|
|
<p>List your bulk tracking jobs</p>
|
|
</div>
|
|
|
|
<h2>📋 Export</h2>
|
|
|
|
<div class="endpoint">
|
|
<span class="method get">GET</span> <code>/api/v2/export/:checkId/markdown</code>
|
|
<span class="badge">Auth Required</span>
|
|
<p>Export check results as Markdown report</p>
|
|
</div>
|
|
|
|
<div class="endpoint">
|
|
<span class="method get">GET</span> <code>/api/v2/export/:checkId/pdf</code>
|
|
<span class="badge">Auth Required</span>
|
|
<p>Export check results as PDF report</p>
|
|
</div>
|
|
|
|
<h2>⚡ Rate Limiting</h2>
|
|
<p><strong>Anonymous Users:</strong> ${apiDocumentation.rateLimit.anonymous}</p>
|
|
<p><strong>Authenticated Users:</strong> ${apiDocumentation.rateLimit.authenticated}</p>
|
|
|
|
<h2>🌐 Frontend Application</h2>
|
|
<p><strong>Main App:</strong> <a href="https://urltrackertool.com">https://urltrackertool.com</a></p>
|
|
<p>Full-featured React application with dashboard, tracking interface, and analytics.</p>
|
|
|
|
<hr style="margin: 30px 0;">
|
|
<p style="text-align: center; color: #666;">
|
|
🔗 <strong>Redirect Intelligence v2</strong> - Professional Redirect Tracking & Analysis Platform
|
|
</p>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
`;
|
|
res.setHeader('Content-Type', 'text/html');
|
|
res.send(htmlDoc);
|
|
});
|
|
router.get('/docs/json', (req, res) => {
|
|
res.json(apiDocumentation);
|
|
});
|
|
exports.default = router;
|
|
//# sourceMappingURL=docs.routes.js.map
|