How do I serve Pokemon sprites through an API

I'm learning about writing APIs, and to do that I'm trying to write my own Pokemon GraphQL API. I want it to be able to serve an extensive collection of Pokemon sprites, and I'm trying to find a good way to go about it. I intend to use a MySQL database to hold all the data and serve as the backend for the API.

I know that the PokeAPI sprite Github repo has all the sprites nicely organized, but I'm having trouble understanding how I would use it in my API. At the top of their README.md it says:

To save load on PokéAPI, we host all the sprite images here. If you want to use all the sprites in your application, you can just download the entire contents directly.
  1. How should I store the sprites in my database? Should I store the images themselves, or could I instead store the URLs and have my API serve those? I'm trying to do this project for as low a cost as possible, so even if all the sprite images together are just a little over half a GB, I'm not sure whether I could host those (if you know any good options for that, let me know! A few dollars a month is fine with me, but not more than that).
  2. If I should store the images themselves, then it seems like I need to download the contents of the PokeAPI repo. If instead I can store the URLs, should I still download their repo as their README.md says? Or could I just store the URL to the appropriate sprite in the PokeAPI repo?
Thank you!
 

Annika

is a Battle Simulator Administratoris a Community Leaderis a Programmer
PS Admin
If you're trying to minimize costs, just storing links to an external sprite-hosting site is probably going to result in the least storage and bandwidth usage. However, it would mean that if the external site(s) you link to went down, your API wouldn't be very useful.

Unless you're planning to get a lot of traffic on your API, 1 GB of storage and a few GB of bandwidth shouldn't cost much, so it may not be an issue to host the images yourself.
 
Thanks for the reply! I think I prefer the first option, but I wanted to be careful about which site I use. I've been considering a couple sources for the sprites (pokemondb.net and the [USER=44830]pkmn[/USER]/img package) but they both discourage linking directly to their sprites, so I wanted to check what others usually do for this kind of thing. It seems like the PokeAPI repo I mentioned in my previous post is my best bet then. I assume that since it's hosted on GitHub, it wouldn't cost the people who run PokeAPI.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top