Save Data Using

Save Data Using

The website has been mentioned quite a bit recently. It provides a really easy way to store and retrieve data. It's perfect if you're trying to store non-sensitive, public data.

Using is super easy. First, you have to visit and copy your endpoint.

If you're unfamiliar, an "endpoint" is basically some URL where you can access some service. In this case, you're accessing the service.

There are two main operations that I'm going to go over

  • retrieving data
  • storing data

Retrieving Data

To retrieve data, you can simply access the endpoint URL.

As you can see, there isn't much there. (Note that I'm using a Chrome Extension called "JSON Viewer" that makes JSON data more readable)

If you want to do this programmatically, simply send a GET request to the endpoint. In Node, you can use the Axios package to easily send a GET request.

As you can see, we get the same output!

Storing data

If you want to store some data, you just have to send a POST request to your endpoint. For example, if you are using Axios, you can do something like this:

That will send the following data:

A few people in the replit community made some packages to make the process a bit easier. @TheDrone7 made a JavaScript package called async-jsonstore-io and @leon332157 made a Python module called json-store-client. If you're feeling a bit adventurous, you can use those packages!

Storing your Endpoint in an Environment Variable

In the above examples, I assigned the endpoint to a variable directly, like this:

However, that's really bad practice since anyone that opens up our repl can find the URL, and retrieve or store data without us knowing about it. We want to hide the URL. To do this, we can utilize .env files, which will hide the information.

For Node, there is a package called dotenv. It loads up the variables in the .env file as environment variables.

All you have to do is add a require statement for it.

Now, to use your variable, you can access it as a property of process.env.

You are viewing a single comment. View All

@PDanielY Oh ok. X3 Thanks anyway.