How do databases work on glitch?

#1

im trying to make a site where people can post links to .mp4 files but have no clue how databases work.
so i looked at the faq and saw there was one for databases and saw an example then i tried reverse engineering it but have no clue how it works. is there better documentation on this then just a reference?

#2

I don’t think you should store mp4 files in a database, but you can store the filenames in the databases. Don’t forget to do all of this in the .data folder.

#3

yeah im just gonna store the .mp4 links in the database
and how would i do this?

#4

Hi @DangerCow, welcome to the Glitch forum!

I’m not sure if you’re still looking for an answer to this question, but just in case, you say you looked at the help doc for databases so I presume you looked at https://glitch.com/help/db/ and the collection of database-related projects at https://glitch.com/storage.

You’re curious about how databases work, and that’s probably a bigger topic than can easily be covered here, but many of the sample projects in that list share similar features. A database system generally has three components:

  1. A place to store the data and a way to tell your code where to find the data file
  2. A way to write information to the database
  3. A way to read information out of the database

Each different database system is going to have a different set of commands to do those things, so it’s hard to be more specific without knowing which database technology you’re going to use. A good example for something relatively straightforward like storing links could be something like lowdb as shown in https://glitch.com/~low-db. An intro to how lowdb works and some of the commands available can be found at https://github.com/typicode/lowdb.

We’d be happy to answer more detailed questions if those resources leave you with some.

#5

thanks
i will check it out soon