page.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. 'use client';
  2. import { useEffect } from 'react';
  3. export default function ApiDocs() {
  4. useEffect(() => {
  5. // Load Scalar API Reference dynamically
  6. const script = document.createElement('script');
  7. script.src = 'https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/browser/standalone.js';
  8. script.async = true;
  9. document.body.appendChild(script);
  10. const style = document.createElement('link');
  11. style.rel = 'stylesheet';
  12. style.href = 'https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/browser/style.css';
  13. document.head.appendChild(style);
  14. return () => {
  15. document.body.removeChild(script);
  16. document.head.removeChild(style);
  17. };
  18. }, []);
  19. return (
  20. <div className="min-h-screen bg-gray-50">
  21. <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
  22. <div className="bg-white shadow rounded-lg">
  23. <div className="px-4 py-5 sm:p-6">
  24. <h1 className="text-2xl font-bold text-gray-900 mb-4">
  25. Vtorio API Documentation
  26. </h1>
  27. <p className="text-gray-600 mb-6">
  28. Interactive API documentation for file upload and management endpoints.
  29. </p>
  30. <div
  31. id="api-reference"
  32. data-url="/api/openapi.json"
  33. data-theme="default"
  34. style={{ height: 'calc(100vh - 200px)' }}
  35. />
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. );
  41. }