/mindmap

A simple mind map API

Primary LanguagePython

Mind Map API

We want you to design a mind map web service.

Your service must provide REST API endpoints to create a mind map and store its data in a backend.

Your solution must be written in Python.

Delivery

The latest version of the Image and be pulled from fastboyz/mind-map From there, running it like so docker run --name mind-map -e MONGODB_URI='<<MongoDB URL>>' -e PORT=80 -p 80:80 fastboyz/mind-map will launch the app. The swagger UI can be reach from http://localhost:<<PORT>>/docs

Alternatively, the app can also be reach at https://my-mind-map.herokuapp.com/docs#/

Once dependencies installed, tests can be ran with pytest --cov --cov-branch --cov-report term-missing

To run the app directly from python, first add MONGODB_URI='<<MongoDB URL>> In env, then use uvicorn main:app --reload from the api folder

Requirements

The provided ./bin/run.sh script must be enough to build and / or start the REST API.

Please give us your final version in a Git repository (github, gitlab, ...).

We expect that you provide at least:

  • Unit tests (min coverage: 30%).
  • Persistence: data can be saved in file(s).

If you need support, feel free to contact us.

Review

These are some of the things my colleagues will be looking at when reviewing your test:

  • The API should conform to the specifications (correct endpoints and it should work).
  • Focus on code quality before starting bonus requirements.
  • Don’t reinvent the wheel, use best practices, use the right tool for the job.
  • Your REST API has to start easily without errors (you can provide us a README file to explain how to start it).

Specifications

Create a mind map

curl -X [verb] [something] -H 'content-type: application/json' -d '{"id": "my-map"}'

Add a leaf (path) to the map

$ curl -X [verb] [something] \
  -H 'content-type: application/json' \
  -d '{
    "path": "i/like/potatoes",
    "text": "Because reasons"
}'

Read a leaf (path) of the map

$ curl -X [verb] [something] -H 'content-type: application/json'

Expected response:
{
    "path": "i/like/potatoes",
    "text": "Because reasons"
}

Pretty print the whole tree of the mind map

$ curl -X [verb] [something] 

Expected output:
root/
    i/
        like/
            potatoes
        eat/
            tomatoes

BONUS Requirements

If you have time, feel free to add improvements.

Here are some ideas:

  • Unit tests coverage to 75%.
  • If not already done, a nice storage backend (SQL Database, ...).
  • Docker image.
  • Pipeline to build the docker image, execute the unit tests (example, github + travis CI).
  • Deployment in a Cloud service (Heroku, GCP AppEngine...)