The JSON used as the database is located in app/data/db.py
- Python 3.8+
Clone the repository and navigate to the project directory:
git clone git@github.com:tyronejosee/project_coding_latam_api.git
It is recommended to create a virtual environment to isolate all the project dependencies:
# Linux
python3 -m venv env
# Windows
python -m venv env
Activate the virtual environment:
# Linux
source venv/bin/activate
# Windows
venv\Scripts\activate
You can install the dependencies using pip
or Poetry
.
pip install -r requirements.txt
poetry install
Create a copy of the .env.example
file and rename it to .env
.
cp .env.example .env
Update the values of the environment variables (Important).
To run the application in development mode, use:
uvicorn app.main:app --reload
This will start the server at http://127.0.0.1:8000
.
Once the application is running, you can access the interactive documentation at:
- Swagger UI:
http://127.0.0.1:8000/docs
- Redoc:
http://127.0.0.1:8000/redoc
Log in or sign up at railway.app.
Select New on your dashboard and Deploy from GitHub repo:
Configure and grant permission to the specific repositories for deployment:
Go to the Settings tab of the instance.
Add the command pip install -r requirements.txt
in the Custom Build Command
field:
Add the command uvicorn app.main:app --host 0.0.0.0 --port $PORT
in the Custom Start Command
field:
After completing the Railway process, click on Generate Domain
within Settings
:
And your API will be deployed successfully. 🎉🎉