A web application built with FastAPI for shortening URLs, featuring a user-friendly interface and database integration.
- URL shortening functionality
- FastAPI backend
- Jinja2 templating for frontend
- CORS middleware for cross-origin requests
- Static file serving
- Database integration with SQLAlchemy
- Python 3.7+
- FastAPI
- Jinja2
- SQLAlchemy
- (Other dependencies as needed)
-
Clone this repository:
https://github.com/Jdaniel98/Scissor-App.git cd fastapi-url-shortener -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate` -
Install dependencies:
pip install -r requirements.txt
app/
├── main.py
├── database/
│ ├── db.py
│ └── models.py
├── routers/
│ └── url.py
├── static/
├── templates/
│ └── index.html
└── templates.py
To run the application:
uvicorn app.main:app --reload
The application will be available at http://localhost:8000.
GET /: Home page- (Other endpoints defined in
url_router)
- CORS is enabled for all origins (
"*"). Modify theoriginslist inmain.pyto restrict access if needed. - Database models are defined in
app/database/models.pyand use SQLAlchemy ORM. - Static files are served from the
app/staticdirectory. - HTML templates are located in the
app/templatesdirectory and use Jinja2.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
This project is provided as-is, without any guarantees. Ensure to follow best practices for security and performance when deploying to a production environment.