content.tsx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { MultipleCodeBlock } from 'ui-patterns/MultipleCodeBlock'
  2. import type { StepContentProps } from '@/components/interfaces/ConnectSheet/Connect.types'
  3. const ContentFile = ({ projectKeys }: StepContentProps) => {
  4. const files = [
  5. {
  6. name: '.env',
  7. language: 'bash',
  8. code: `
  9. BRIVEN_URL=${projectKeys.apiUrl ?? 'your-project-url'}
  10. BRIVEN_KEY=${projectKeys.publishableKey ?? projectKeys.anonKey ?? 'your-anon-key'}
  11. `,
  12. },
  13. {
  14. name: 'app.py',
  15. language: 'python',
  16. code: `
  17. import os
  18. from flask import Flask
  19. from briven import create_client, Client
  20. from dotenv import load_dotenv
  21. load_dotenv()
  22. app = Flask(__name__)
  23. briven: Client = create_client(
  24. os.environ.get("BRIVEN_URL"),
  25. os.environ.get("BRIVEN_KEY")
  26. )
  27. @app.route('/')
  28. def index():
  29. response = briven.table('todos').select("*").execute()
  30. todos = response.data
  31. html = '<h1>Todos</h1><ul>'
  32. for todo in todos:
  33. html += f'<li>{todo["name"]}</li>'
  34. html += '</ul>'
  35. return html
  36. if __name__ == '__main__':
  37. app.run(debug=True)
  38. `,
  39. },
  40. ]
  41. return <MultipleCodeBlock files={files} />
  42. }
  43. export default ContentFile