Skip to content

alanuss/Time_through_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sol_i_web: Current time with fastAPI

python check linter check docker check

Python app that returns the current time using fastAPI

Running the app

Docker way

This project is dockerized. You can run it using Docker. Make sure you have Docker installed and running on your machine.

You can run it by building the image and then running the container, or you can pull the image from Docker Hub and run it directly.

By pull

docker pull teg57/sol_i_web
docker run --rm -p 8000:8000 sol_i_web

By build

Clone the repository to your local machine and then build the image using the following commands:

docker build -t sol_i_web .
docker run --rm -p 8000:8000 sol_i_web

Run locally

Make sure that you have a python version greater or equal to 3.12. Then:

Clone the repository:

git clone https://github.com/AlanSilvaaa/sol_i_web.git

Run the next command to install poetry:

pip install poetry

Install depencencies along with a poetry enviroment:

poetry install --no-root

Finally go to src folder and run this command to run the source code:

poetry run uvicorn main:app --port 8000

Test API

There are two ways to test the API, using a browser or using curl.

Browser

After the local server is started, go to your browser and type the following URL:

127.0.0.1:8000/time

Curl

To visualize the result of the local server you can use Curl:

curl http://127.0.0.1:8000/time

If you local server is running fine, it should return something like:

{"Date and time": "2025-04-06 12:34:56"}

Docker Hub link

Here you can find the docker image on Docker Hub.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages