A RESTful Flask API that analyzes strings and stores their computed properties.
Built as part of Backend Wizards — Stage 1 Task.
For each analyzed string, the API computes and stores:
- length → Number of characters in the string
- is_palindrome → True if the string reads the same backward (case-insensitive)
- unique_characters → Count of distinct characters
- word_count → Number of words separated by whitespace
- sha256_hash → Unique SHA-256 hash of the string
- character_frequency_map → Dictionary of each character and its frequency
POST /strings
Request Body:
{
"value": "madam"
}Success Response (201):
{
"id": "sha256_hash_value",
"value": "madam",
"properties": {
"length": 5,
"is_palindrome": true,
"unique_characters": 3,
"word_count": 1,
"sha256_hash": "abc123...",
"character_frequency_map": {
"m": 2,
"a": 2,
"d": 1
}
},
"created_at": "2025-10-22T12:00:00Z"
}GET /strings/{string_value}
Example:
GET /strings/madam
Response (200):
{
"id": "sha256_hash_value",
"value": "madam",
"properties": { ... },
"created_at": "2025-10-22T12:00:00Z"
}GET /strings→ Filter and list all stored stringsGET /strings/filter-by-natural-language?query=...→ Search using natural languageDELETE /strings/{string_value}→ Delete a stored string
- Python 3.8+
- Flask
-
Clone the repository
git clone https://github.com/<your-username>/string-analyzer.git cd string-analyzer
-
Create a virtual environment
python -m venv venv venv\Scripts\activate # For Windows # OR source venv/bin/activate # For Linux/Mac
-
Install dependencies
pip install -r requirements.txt
-
Run the app
python app.py
-
Test locally Open Postman or your browser:
http://127.0.0.1:5000/strings
-
SSH into your instance
ssh -i "your-key.pem" ubuntu@<EC2-public-IP>
-
Install dependencies
sudo apt update && sudo apt upgrade -y sudo apt install python3-pip python3-venv git -y -
Clone your repo
git clone https://github.com/<your-username>/string-analyzer.git cd string-analyzer
-
Set up and run
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt python3 app.py -
Access the API
http://<EC2-public-IP>:5000
curl -X POST http://127.0.0.1:5000/strings \
-H "Content-Type: application/json" \
-d '{"value": "racecar"}'- Language: Python
- Framework: Flask
- Deployment: AWS EC2 (Ubuntu)
- Hashing: hashlib (SHA-256)
John Abioye (John Billon) Backend Wizards — Stage 1 📧 Email: your.email@example.com 🌐 GitHub: @your-username