Shortest path algorithm, tests and Postman
- Added algorithm and endpoint to find the shortest path between two topics; - Added respective test; - Added a JSON collection with API calls that can be imported into Postman for the convenience of the user.
This commit is contained in:
parent
f1170341fb
commit
d7748229ef
9 changed files with 419 additions and 118 deletions
24
README.md
24
README.md
|
@ -20,7 +20,11 @@ npm run start
|
|||
|
||||
## Usage
|
||||
|
||||
You can use Postman or Curl to make calls to the API. The examples below use Curl.
|
||||
You can use Postman or Curl to make calls to the API.
|
||||
|
||||
If using Postman, you can import the collection `ProjectMark.postman_collection.json` from the root.
|
||||
|
||||
The examples below use Curl.
|
||||
|
||||
### Create a topic:
|
||||
|
||||
|
@ -76,6 +80,24 @@ curl -X DELETE http://localhost:3000/api/topics/1234567890
|
|||
|
||||
> Replace `1234567890` with the topic id.
|
||||
|
||||
## Utilities
|
||||
|
||||
### Retrieve topic and all its subtopics recursively
|
||||
|
||||
```sh
|
||||
curl -X GET http://localhost:3000/api/topics/recursive/1234567890
|
||||
```
|
||||
|
||||
> Replace `1234567890` with the topic id.
|
||||
|
||||
### Shortest path between two topics in a tree
|
||||
|
||||
```sh
|
||||
curl -X GET http://localhost:3000/api/topics/shortest/1234567890/0987654321
|
||||
```
|
||||
|
||||
> Replace `1234567890` and `0987654321` with the topic ids.
|
||||
|
||||
## Tests
|
||||
|
||||
Run tests with:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue