This is a basic Express app that returns a random word in different languages.
To run the app, first install the dependencies by running yarn
. Then, start the server by running yarn dev
. The server will be listening on port 3001 by default.
To get a random word from the API, make a POST
request to the root endpoint /
. The API will return a JSON object with a single key word that contains the random word.
POST /
Response:
{
"word": "thermobarometer"
}
To specify the desired language, include a locale
key in the request body with one of the supported language codes.
POST /
FormURLEncoded:
{
"locale": "fr-FR"
}
Response:
{
"word": "nomenclature"
}
If no locale key is included in the request body, the API will default to using British English.
fr-FR
: Frenchen-GB
: British English
Using React, create a hangman game that calls an API to get a random word to be guessed. The project will be graded on functionality, code quality, design and styling.
The hangman game should be functional and display the correct number of blank spaces for the word that is being guessed. The user should be able to enter letters to guess the word, and the game should update to show the correct letters and the hangman figure.
The game should handle errors gracefully and display appropriate error messages if the API request fails.
Any other extra feature is welcomed.
(Using TypeScript properly will be rewarded)
The code should be well-structured and easy to read. You should use proper variable names and follow best practices for React development. The code should be organized into reusable components where appropriate.
The game should be visually appealing and user-friendly, with an intuitive user interface. You should demonstrate your proficiency in CSS but the use of a helping library is allowed.