Public web service linking nodes from input collection and parameters.
- Implement TLS support
- Implement non existing resource request handling
- Implement not supported HTTP method handling
- Implement logging
- Implement illogical list handling
- Implement 100% test coverage
- Optimize link autodiscovery algorithm
- Optimize linking algorithm
Requires:
- GNU/Linux OS
- Git
- Composer
- Docker
- Free 8080 ports on dev environment
git clone git@github.com:opportus/linker-service.git
cd linker-service
composer install --ignore-platform-reqs
sudo docker-compose --file docker/dev/docker-compose.yaml up
The single operation endpoint accepts 2 query parameters as input, both optional:
link
with pattern/^([A-Za-z0-9\_\-]*):*([A-Za-z0-9\_\-]*)$/
(previous_node_attribute:next_node_attribute
). If no link is provided, the service tries to discover a link among the nodes in the list.list
containing nodes to link. If no list is provided, the service returns an empty list.
If the previous_node_attribute
value matches the next_node_attribute
value, then the next node is
appended to the linked list right after the previous node...
Input list:
[
{
"departure": "cityB",
"arrival": "cityC"
},
{
"departure": "cityA",
"arrival": "cityB"
},
{
"departure": "cityD",
"arrival": "cityE"
},
{
"departure": "cityE",
"arrival": "cityF"
},
{
"departure": "cityC",
"arrival": "cityD"
}
]
Web service API call:
curl -X GET -G \
'http://localhost:8080' \
-d "link=arrival:departure" \
-data-urlencode "list=$(cat list.json)"
Beautified linked list output:
[
{
"departure": "cityA",
"arrival": "cityB"
},
{
"departure": "cityB",
"arrival": "cityC"
},
{
"departure": "cityC",
"arrival": "cityD"
},
{
"departure": "cityD",
"arrival": "cityE"
},
{
"departure": "cityE",
"arrival": "cityF"
}
]