Skip to content

TypeScript / JS SDK

ติดตั้ง Official TypeScript SDK จาก GitHub Packages:

Terminal window
npm install @techasit5415/microbase-sdk

ตัวอย่างการใช้งาน

Section titled “ตัวอย่างการใช้งาน”
import Microbase from '@techasit5415/microbase-sdk';
const mb = new Microbase('http://localhost:3000');
// ล็อกอินผู้ใช้
await mb.collection('users').authWithPassword('user@example.com', 'password123');
// ดึงรายการ records
const posts = await mb.collection('posts').getList(1, 20, {
filter: 'published = true',
sort: '-created_at',
expand: 'author',
});
// รับ event แบบ realtime
await mb.collection('posts').subscribe('*', (e) => {
console.log(e.action, e.record);
});