This code defines a GraphQL API, to be used in Pokemon apps. It runs with Apollo Server with a MySQL database on the backend.
If you want to add data to this project, I have written out a detailed example on doing so across these README.md
files in the repo for the database, as well as in this repo. I have organized my code so as to facilitate inserting new data, and several of the conventions I have employed in processing the data are to this end. These are described in the appropriate README.md
file.
src/README.md
describes the overall structure of this repository.
Currently I do not have the finds or expertise to host this API (for example, there's no security in place restricting what users can query). Once you've set up the MySQL database, running this API on your own machine is easy:
- Write a
.env
file in this directory with the same database credentials you used for setting up the MySQL database (exact same format). - Run
npm start
in this folder. You should then get the messageServer is running on http://localhost:4000/
, where you can run GraphQL queries.
- Add filters for
Edge
s: For example, in themoves
field for aPokemon
, one could pass inedgeFilter: { learnMethods: ["M", "T"] }
to select onlyPokemonMoveEdge
s corresponding toMove
s learned via TM/HM or via Move Tutor. - Optimize database queries: Currently, queries against the MySQL backend use
SELECT * FROM
for the majority of queries. Most columns are relatively narrow, since they mainly consist ofSMALLINT
s orTINYINT
s, but of course the user won't always request from every column in a table. Theinfo
argument to the resolvers contains information on the fields actually being requested in a given query. I haven't yet done a performance analysis to identify bottlenecks in querying (other factors including setting up a connection to the database, network latency, etc.) to determine whether using a more specificSELECT
statement would significantly speed up queries.