0

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?

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Feb 12 '23 at 19:47

1 Answers1

-1

Try JSON.stringify({ "num": num }) or change the key to something else like number

Tyler2P
  • 2,324
  • 26
  • 22
  • 31