page.tsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { ApiReferenceReact } from '@scalar/api-reference-react'
  2. import '@scalar/api-reference-react/style.css'
  3. const openApiSpec = {
  4. openapi: '3.0.3',
  5. info: {
  6. title: 'Vtorio API',
  7. version: '1.0.0',
  8. description: 'File upload and management API for Vtorio application',
  9. },
  10. servers: [
  11. {
  12. url: 'http://localhost:3000',
  13. description: 'Development server',
  14. },
  15. ],
  16. components: {
  17. schemas: {
  18. File: {
  19. type: 'object',
  20. properties: {
  21. id: { type: 'string' },
  22. filename: { type: 'string' },
  23. mimetype: { type: 'string' },
  24. size: { type: 'number' },
  25. createdAt: { type: 'string', format: 'date-time' },
  26. updatedAt: { type: 'string', format: 'date-time' },
  27. },
  28. required: ['id', 'filename', 'mimetype', 'size', 'createdAt'],
  29. },
  30. Error: {
  31. type: 'object',
  32. properties: {
  33. success: { type: 'boolean', example: false },
  34. error: { type: 'string' },
  35. },
  36. required: ['success', 'error'],
  37. },
  38. },
  39. },
  40. paths: {
  41. },
  42. }
  43. export default function ApiDocs() {
  44. return (
  45. <div className="min-h-screen bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-900 dark:to-gray-800">
  46. <div className="container mx-auto px-4 py-8">
  47. <div className="mb-8">
  48. <h1 className="text-3xl font-bold text-gray-900 dark:text-white mb-2">
  49. Vtorio API Documentation
  50. </h1>
  51. <p className="text-gray-600 dark:text-gray-300">
  52. Interactive API documentation for file upload and management endpoints.
  53. </p>
  54. </div>
  55. <div className="bg-white dark:bg-gray-800 shadow rounded-lg border dark:border-gray-700">
  56. <div className="px-4 py-5 sm:p-6">
  57. <ApiReferenceReact
  58. configuration={{
  59. content: openApiSpec,
  60. theme: 'default',
  61. layout: 'modern',
  62. darkMode: true,
  63. }}
  64. />
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. )
  70. }