In src
folder there are self sufficient files with immudb showcases.
Use them to play and learn immudb.
First clone repository. Then cd
to showcase module and install dependencies:
cd immudb-node-showcase
npm install
Then run showcase from (git) root directory (To have predictable output it is best to restart immudb docker image before every showcase run):
$ docker run -d -it --rm -p 8080:8080 -p 3322:3322 -p 9497:9497 -p 5432:5432 --name immudb codenotary/immudb:1.3.2
$ npx ts-node --esm ./immudb-node-showcase/src/overview-showcase.ts
$ docker stop immudb
$ docker run -d -it --rm -p 8080:8080 -p 3322:3322 -p 9497:9497 -p 5432:5432 --name immudb codenotary/immudb:1.3.2
$ npx ts-node --esm ./immudb-node-showcase/src/sql-showcase.ts
$ docker stop immudb
$ docker run -d -it --rm -p 8080:8080 -p 3322:3322 -p 9497:9497 -p 5432:5432 --name immudb codenotary/immudb:1.3.2
$ npx ts-node --esm ./immudb-node-showcase/src/zSet-showcase.ts
$ docker stop immudb
Create your file in immu-node-showcase
module folder:
cd immu-node-showcase
code 'src/my-showcase.ts'
Import client and implement your showcase:
import { Client } from 'immudb-node'
myShowcase()
.catch(console.error)
function myShowcase() {
const defaultClient = new Client({
host: '127.0.0.1',
port: 3322,
user: 'immudb',
password: 'immudb',
database: 'defaultdb',
})
// ... code
console.log('Log something')
await defaultClient.close()
}
Remember to have your immudb instance running:
docker run -d -it --rm -p 8080:8080 -p 3322:3322 -p 9497:9497 -p 5432:5432 --name immudb codenotary/immudb:1.3.2
Run your showcase:
npx ts-node --esm './src/my-showcase.ts'