A web application using Flask.
Return a JSON object with the key “return_string” and a string containing every third letter from the original string.
POST /test
Parameter:
Name | Type | In | Description |
---|---|---|---|
string_to_cut | string | request | String to be cut every third letter |
Example:
If you post request:
$ curl -X POST localhost:5000/test --data '{"string_to_cut": "iamyourlyftdriver"}' -H 'Content-Type: application/json'
the application will return:
{
"return_string": "muydv"
}
Use a virtual environment to manage the dependencies for the project.
Python comes bundled with the venv
module to create virtual environments
$ mkdir myproject
$ cd myproject
$ python3 -m venv venv
$ . venv/bin/activate
pip install flask-restful
$ python app.py