No Description

Joe Ceresini a1e0695166 Added python examples to README 7 years ago
bash bf66cabe29 Reorganizing 7 years ago
python c9581fd03f Adding a sample systemd unit file, not the recommended way to run this though 7 years ago
testfiles 660dde1db0 Adding test text files 7 years ago
README.md a1e0695166 Added python examples to README 7 years ago

README.md

Some tests building a simple API that determines whether an input string contains every lower-case character in the latin alphabet

Bash version

Sample output

# Sample string with all alphabet characters
[jceresini@slartibartfast ~]$ curl -X POST -d 'The quick brown fox jumps over the lazy dog' http://test.ceresini.com/contains_all_chars.sh

{"error": null, "result": true}

# Sample string that doesn't contain all alphabet characters
[jceresini@slartibartfast ~]$ curl -X POST -d 'This string does not contain many letters of the alphabet' http://test.ceresini.com/contains_all_chars.sh

{"error": null, "result": false}

# Hitting API endpoint with GET method
[jceresini@slartibartfast ~]$ curl http://test.ceresini.com/contains_all_chars.sh

{"error": "Invalid http method", "result": null}

Python version

Simplified call using sets

[jceresini@slartibartfast]$ curl -H "Content-type: text/plain" -d "@testfiles/doi.txt" http://test.ceresini.com:5000/contains_all_chars_a
{"result": true, "error": null}

[jceresini@slartibartfast]$ curl -H "Content-type: text/plain" -d "@testfiles/doi-no-z.txt" http://test.ceresini.com:5000/contains_all_chars_a
{"result": false, "error": null}

[jceresini@slartibartfast]$ curl -H "Content-type: text/plain" -d "@testfiles/doi-allcaps.txt" http://test.ceresini.com:5000/contains_all_chars_a
{"result": false, "error": null}

Slower call iterating over the input string

[jceresini@slartibartfast]$ curl -H "Content-type: text/plain" -d "@testfiles/doi.txt" http://test.ceresini.com:5000/contains_all_chars_b
{"result": true, "error": null}

[jceresini@slartibartfast]$ curl -H "Content-type: text/plain" -d "@testfiles/doi-no-z.txt" http://test.ceresini.com:5000/contains_all_chars_b
{"result": false, "error": null}

[jceresini@slartibartfast]$ curl -H "Content-type: text/plain" -d "@testfiles/doi-allcaps.txt" http://test.ceresini.com:5000/contains_all_chars_b
{"result": false, "error": null}