How to save data(Web)
Ok, SO I want to be able to create websites. But I want to create websites which can save data ON A SERVER.
I have been thinking about 2 options
- JSON +
I know that for XMLHttpRequest's, you need to find a way to host the json file. I do not know if the
https://repl.it/@EpicGamer007/[Name of repl here]#Thing.json would work. My question with that s would I be able to send data and receive data from that json file.
I know that it is possible with node. But IDK how to use node for this.
If anyone can help with this, that would be great
Thanks to all answers :D
Most of the time client databases are insecure, there are tools such as Firebase that can help though. The most secure database, and the easiest, would be to have a Node.JS database. Here are some options:
- Repl.it Database: A very well suited tool specified for Repl.it, also super easy to work with and simple to setup. It also just came out of beta.
- MongoDB: This is super secure, has been used for years, but it is very hard to work with and you will need a bit of tutorials to setup.
- SQLite: Not much to say about this one, but it uses SQL format so you will need to turn your caps lock on.
Personally, I would use Repl.it Database just because it is specified for Repl.it and is insanely easy to setup. There are many tutorials on Repl.it such as Coder100's https://repl.it/talk/learn/Replit-DB/43305
@EpicGamer007 blogs would take a bit of data, lets say each blog post is about 1500 characters and with titles and with the other stuff it hits 2kb per post.
That would give you 25,000 blog posts, so if you are expecting at least half as many, I would get an external db, but 25,000 is a lot, so for a mini-project, it should be okay. MongoDB gives 512mb for free, but it is much harder to setup.
@SpicedSpices Repldb should only be used for toy projects and also is kinda buggy sometimes
mongodb is pretty nice! ofc for more than 5 gig (I think) of storage, which is a lot for free, but after that you gotta pay, and I have to say its not saving the data in the repl
sqlite is cool and pretty sure it works on repl.it. maybe the best option? repl.it repls have storage limits too, pretty sure... also it would be publically visible, although you could encrypt it. So, I think this means mongodb has the highest storage limit with 512 MB to 5 GB?
You'd need to set up a request using Node's HTTP server or use Express (a Node library) to route the request data to something like ReplDB.
use crosis (crosis is repl.it api) to append it to a json file
mark as answered if this helped you, I guess? thanks
@EpicGamer007 http://crosis.turbio.repl.co/ (you will need api key also)
hmm, doesn't seem too hard to use (for this instance anyway)?
http://crosis.turbio.repl.co/services this seems like it provides a way to change file contents... but then it also says changes do not persist?
Idk, worth giving a try. Assuming this works, this is probably the only "true" way to host on the website repl thingy programatically.