alicedb
v1.0.1-4
Published
'AliceDB is TCP and HTTP memory database'
Downloads
3
Readme
Alice DB is a TCP and HTTP Memory database
npm install alicedb
Server
const { AliceDBHTTPServer } = require('alicedb/server')
const AliceDBServer = new AliceDBHTTPServer({
HTTP_PORT: 2706
})
AliceDBServer
.start()
.then( response => {
console.log('AliceDB server is running!', JSON.stringify(response))
})
.catch(error => {
console.log('Alice ERROR!', error)
})
Client
How to connect
import { AliceDBClient } from 'alicedb'
const AliceDB = new AliceDBClient()
AliceDB.connect({
port: 2706,
address: '127.0.0.1'
}).then(db => {
// db
console.log('connected to AliceDB')
})
Create new table
...
db.createTable(tableName)
.then( table => {
console.log('new table created ', table)
})
.catch(error => {
console.log(error)
})
Create new record
...
table
.add({
name: "Durand Neto",
email: "[email protected]"
})
.then(row => {
console.log('new row added ', row)
/**
*
* {
uuid: add from server,
name: "Durand Neto",
email: "[email protected]"
}
*/
})
.catch( error => {
console.log(error)
})
remove record
...
table
.remove(uuid)
.then(() => {
console.log('row removed')
})
.catch( error => {
console.log(error)
})