Ask coding questions

← Back to all posts
how to use repl.it db in node?
exp1109

i want some repl.it db example in node.
but there's no example.

The code I'm currently writing is this.

const Database = require('@replit/database');
const db = new Database();
var valuee;
var val;
db.set("key", "value", "value1").then(() => {
});
db.get("key").then(value => {
valuee = value;
});
console.log(valuee);
console.log(val);
This code sends: undefined

Answered by DynamicSquid [earned 5 cycles]
View Answer
Voters
exp1109
Comments
hotnewtop
DynamicSquid

Here's the Node example: https://www.npmjs.com/package/@replit/database
And just some general information: https://docs.replit.com/misc/database

exp1109

@DynamicSquid thanks!!!

r3b0rn

on the side there is this button for replit db!

exp1109