How Do I Access Other Repl.It Databases From Different Repls?
I just want to get one value for one key. I am programming in Node.js and have little to no experience with external APIs, but I tried played around with the Repl.it database URL using a API testing tool (ReqBin) and wasn't able to accomplish anything.
Am I supposed to use the replit-database package to access it or do a GET request to pull data from it. Any help would be appreciated.
There’s a flaw in how they coded ReplDB and integrated it with the Repl so I’ll make it short:
1. Open the Repl which DB you want to use
2. Open the Shell by pressing Ctrl+Shift+S
3. In the shell type
printenv. You will see a lotta stuff pop up. Look for the variable named REPLIT_DB_URL. Note that, copy it, whatever
4. In the other Repl type create a client like normal except with ONE small change:
const client = new Client(LINK YOU COPIED FROM BEFORE)
and now it should work 😊! Let me know how it goes!
Well I just want to say you can't.
The database URL will change so you will have to regenerate each time.
Anyways, I have an option so you can pass the url when making a client:
const client = require("@replit/database"); const DB = new client("[INSERT-URL-HERE]");
and to find that url, just do:
in the repl of your choice.