This repository contains a mind map web service that
- provides REST API endpoints
- achieves persistence
- is written in Python
The service will be available at localhost on port 5000 (http://127.0.0.1:5000)
# Install dependencies
pip install -r requirements.txt
# Build & start REST API
./bin/run.shThe mind map webservice is unit tested using Bitbucket Pipelines. You can click on the bash unittest.sh dropdown in the Pipelines section to see that the unit tests provide 100% coverage
Name Stmts Miss Branch BrPart Cover
----------------------------------------------------------
service/main.py 18 0 0 0 100%
service/mindmap.py 29 0 4 0 100%
service/persistance.py 15 0 0 0 100%
service/tree.py 34 0 22 0 100%
----------------------------------------------------------
TOTAL 96 0 26 0 100%
To run the unit tests yourself locally, simply run
# Run unit tests locally & output coverage
./unittest.sh$ curl -X POST http://127.0.0.1:5000 \
-H 'content-type: application/json' \
-d '{"id": "YOUR_ID_HERE"}'$ curl -X POST http://127.0.0.1:5000/YOUR_ID_HERE \
-H 'content-type: application/json' \
-d '{
"path": "YOUR/PATH/HERE",
"text": "YOUR TEXT HERE"
}'$ curl -X GET http://127.0.0.1:5000/YOUR_ID_HERE/YOUR/PATH/HERE
# Expected response:
{
"path": "YOUR/PATH/HERE",
"text": "YOUR TEXT HERE"
}$ curl -X GET http://127.0.0.1:5000/YOUR_ID_HERE
# Expected output:
root/
YOUR/
PATH/
HERE
OTHER/
LEAFTo get the above pretty print, it is assumed that the following request was also sent
$ curl -X POST http://127.0.0.1:5000/YOUR_ID_HERE \
-H 'content-type: application/json' \
-d '{
"path": "YOUR/OTHER/LEAF",
"text": "MORE TEXT HERE"
}'