I'm trying to use @replit/database for my backend, couldn't get it to display anything other than [object Object]
This is the code that I have
const Database = require("@replit/database")
const db = new Database()
app.get("/click", (req, res) => {
num = db.get("num").then(value => {})
res.send(JSON.stringify({num: num}))
});
Expected Output: A number that was previously saved Output: object object
Is there any way I can fix this?
Try
JSON.stringify({ "num": num })
or change the key to something else like number