只需要一台 VPS,搭建自己的 Serverless Database ☝️
import easyDB from 'mm-db';
// Create a db instance
const db = easyDB({
server: '127.3.4.23',
database: 'b988472d-500a-4e8c-a430-1d735a23e348',
token: 'a437bcd9-c4b8-458a-a87e-27e6dd02d106'
})
// Use a callback
db.Put('myKey', {some: 'data'}, (value, err) => {})
db.Get('myKey', (value, err) => {})
db.Delete('myKey', (value, err) => {})
db.List((value, err) => {})
// Or, async/await
let value, values
async (() => {
value = await db.Put('myKey', {some: 'data'})
value = await db.Get('myKey')
value = await db.Delete('myKey')
values = await db.List()
})()