We want you to build a few endpoints in this backend service to support the classic game Minesweeper (Google provides a free to play option here if you've never played it).
We've setup this repository with a ready-made NestJS app that inlcudes a docker-compose file for a local Postgres database and TypeORM to interact with said database.
We're not looking to be overly prescriptive in your approach. Things like validation, testing, optimizations are completely up to you.
- Clone/Fork this repo to get started
- Add endpoints to do the following:
- Create a new game via
POST /games
- User's should be able to specify the grid size via
rows
andcolumns
inputs - This should create:
- A new item in the
games
table - All the
game_cells
requested by the user (note: a random amount of cells need to be mines) - EXTRA CREDIT: Implement the logic to populate
game_cells.neighboring_bomb_count
- A new item in the
- User's should be able to specify the grid size via
- Get a list of games via
GET /games
- Inputs, validation, and response design is up to you
- Create a new game via
- Include a write up in
IMPLEMENTATION_NOTES.md
file at root of the project describing the what/why/how of your implementation. We want to know why you used certain libraries/techniques as well as what trade-offs you made etc.
We have provided a few convenient scripts to get you up and running fast
- Once you've cloned your forked repo to your computer run
yarn install
- To start the application you can use
yarn start:dev
. This will "watch" your changes to aid in fast developement interation. It will also start the docker container and create/up the database volume.
- You can use
yarn db:start
andyarn db:stop
to bring up or down the database. - You can also completely reset your database with
yarn db:reset
(helpful while implementing your data model changes)