This repository contains a coding exercise for new developers joining the backend development team.
Fork this repository and create your own exercise!
We have provided you with Pokemon data in a json file. Your mission is to create a database and expose the database to an API. Basically, you need to:
- Design the database to store information for the Pokemon data
- Load the database with the data
- Implement the API Interface with the following features:
- Query pokemons with the options:
- Pagination
- Search by name
- Filter by pokemon type
- Filter by favorite
- Query a pokemon by id
- Query a pokemon by name
- Query list of pokemon types
- Mutation to mark/unmark pokemon as favorite
- Query pokemons with the options:
- Test are important and if time allows it, we'd like to see some test coverage
Remember that our technology stack is:
- Node.js (Typescript, Fastify)
- GraphQL (Nexus)
- PostgreSQL (Objection.js)
You can use the framework that you prefer, but please write the challenge in JS or TS. You can choose PostgreSQL / MongoDB like database, be free but take in consideration the best database to store the data.
Libraries do not have to be compiled to CommonJS because they are not supposed to be publicly available via an NPM registry.
Used Pothos GraphQL framework in favor of Nexus. Why? I always wanted to try Pothos and see how the code would look with this library; this was a great opportunity.
nvm use
switch to required Node.js versionnpm install -g pnpm
installpnpm
tool (see https://pnpm.io/installation)pnpm i
install project dependenciespnpm demo
build and run the project, or you can do it manually step by step:- build the project
pnpm build
- run unit and e2e tests
pnpm test
(optional) - init database
pnpm db:init
- seed database
pnpm db:seed
- and start the API service
pnpm start
- build the project
GraphQL endpoint is available at http://localhost:3000/graphql