- Add index.ts with SDK usage examples - Add package.json with dependencies - Add .gitignore - Update README with quick start guide
23 lines
633 B
TypeScript
23 lines
633 B
TypeScript
// Lubes Hot Repo - Main Entry Point
|
|
import { Lubes } from '@lubes/sdk'
|
|
|
|
const client = new Lubes({
|
|
projectId: process.env.LUBES_PROJECT_ID!,
|
|
apiKey: process.env.LUBES_API_KEY!,
|
|
})
|
|
|
|
async function main() {
|
|
// Query the database
|
|
const users = await client.db.query('SELECT * FROM users LIMIT 10')
|
|
console.log('Users:', users)
|
|
|
|
// Upload a file to storage
|
|
await client.storage.upload('avatars', 'example.png', Buffer.from('...'))
|
|
|
|
// Call a serverless function
|
|
const result = await client.functions.invoke('hello-world', { name: 'Lubes' })
|
|
console.log('Function result:', result)
|
|
}
|
|
|
|
main().catch(console.error)
|