Welcome to the Greeting API! This is a simple FastAPI (with Poetry) project that offers a friendly greeting message. The API has three endpoints: a homepage greeting, a morning greeting, and a night-time message.
This API offers three endpoints:
/
: A Greeting welcome message to greet you when you visit the homepage./morning
: A cheerful morning greeting to start your day with positivity./night
: A soothing night-time message to wish you sweet dreams.
To install and run this API locally, follow these steps:
- Clone this repository to your local machine:
git clone https://github.com/saadfrhan/fastapi-poetry-helloworld
- Navigate to the project directory:
cd fastapi-poetry-helloworld
- Install the dependencies using poetry:
poetry install
- Activate Poetry virtual environment:
poetry shell
-
Adjust active python interpreter from your code editor settings (if needed). Set that Python interpreter as active which shows the virtual environment name in between.
-
Run test files:
poetry run pytest -v
- Run the FastAPI server:
poetry run uvicorn fastapi_poetry_helloworld.main:app --reload
- You're all set! 🎉 The API should now be running locally at
http://127.0.0.1:8000
.
- Access the Swagger UI documentation: http://127.0.0.1:8000/documentation
- Access the ReDoc documentation: http://127.0.0.1:8000/redoc
Once the API is running, you can interact with it using your preferred API client or web browser. Here are some example requests:
- Visit
http://127.0.0.1:8000/
to see the Greeting welcome message. - Visit
http://127.0.0.1:8000/morning
to receive a cheerful morning greeting. - Visit
http://127.0.0.1:8000/night
to receive a soothing night-time message.
Feel free to explore and enjoy the friendliness of this API! If you have any questions or feedback, don't hesitate to reach out.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. Star the project if you like it.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request