druv5319 / Sneaks-API

A StockX, FlightClub, Goat, and Stadium Goods API all in one. This sneaker API allows users to search sneakers and track and compare prices while providing additional info such as product links and images
438 stars 118 forks source link

Converting to an integrated/embedded database #4

Open druv5319 opened 3 years ago

druv5319 commented 3 years ago

Having a database within this API makes it so searched sneakers including their links to each of the resell sites are cached. Because of this, when searching for product prices, the API is instantly able to grab prices with the product links already cached from previous searches. Currently, this API is dependant on MongoDB and requires users to install MongoDB and have its process running. I'm looking for a way so users don't have to install and run MongoDB, any contributions are greatly appreciated, thanks!

invictus2010 commented 3 years ago

I think nedb would be well suited for this. I need to figure out where you're using the database in the current code though.

druv5319 commented 3 years ago

It’s used only within the getProducts function and getProductPrices function within the controller file where the Sneaks class is located.

druv5319 commented 3 years ago

I am also using a mongoose schema for the Sneaker object so I’m not sure if nedb will be compatible with it.

invictus2010 commented 3 years ago

Yeah, I see/saw. I might use this as a guide to see what we can do with it: https://www.sderosiaux.com/articles/2015/02/09/creating-an-api-with-nodejs-expressjs-nedb-and-mongodb/#save-the-data-inside-a-database-nedb

invictus2010 commented 3 years ago

Maybe the camo library could help transition it over from mongoDB to nedb? Allows use of a schema.

invictus2010 commented 3 years ago

I'm dying here bc mongoDB is acting up for me lol...get some strange errors running it on my Mac