This is a simple anagram API that allows you to add words to a dictionary and check if a word is an anagram of any words in the dictionary.
This project requires .NET 6.0 and Docker to run.
To run the API, run the following commands in the root directory of the project:
- Build the API:
docker build -t anagram-ws:lastest .
- Run the API:
docker run -d -p 5000:5000 --name anagram-ws anagram-ws:latest
This will build the API and run it in a Docker container. The API will be available at http://localhost:5000.
To run the tests, run the following command in the root directory of the project:
dotnet test
Returns a list of anagrams of a word.
URL : `/anagram/find/[word]
Method : GET
Data constraints
Provide the word to find anagrams of in the URL.
Url example
/anagram/find/chien
Code : 200 OK
Content example
[
"chine",
"niche"
]
** Condition** : If an error occurs.
Code : 500 Internal Server Error
Adds a word to the dictionary.
URL : /anagram/add
Method : POST
Data constraints
Provide the word to add in the request body.
{
"word": "[word to add]"
}
Data example
{
"word": "chien"
}
Code : 201 Created
Content example
{
"message": "The word 'chien' was added to the dictionary."
}
Condition : If the word is already in the dictionary.
Code : 400 Bad Request
Condition : If the word is empty or missing
Code : 400 Bad Request
Condition : If an error occurs.
Code : 500 Internal Server Error
Removes a word from the dictionary.
URL : /anagram/remove
Method : POST
Data constraints
Provide the word to remove in the request body.
{
"word": "[word to remove]"
}
Data example
{
"word": "chien"
}
Code : 200 OK
Content example
{
"message": "The word 'chien' was removed from the dictionary."
}
Condition : If the word is not in the dictionary.
Code : 400 Bad Request
Condition : If the word is empty or missing
Code : 400 Bad Request
Condition : If an error occurs.
Code : 500 Internal Server Error
Count the number of words in the dictionary that have anagrams.
URL : /anagram/count
Method : POST
Data constraints
None
Code : 200 OK
Content example
{
"count": 2
}
Condition : If an error occurs.
Code : 500 Internal Server Error
This project is licensed under the MIT License - see the LICENSE file for details