You’ve built a web app with FastAPI to create and manage shortened URLs. With your URL shortener, you can now convert long URLs into tiny, shareable links. When someone clicks your shortened URL, then your URL shortener app will forward them to the targeted URL.
In this video course, you learned how to:
- Create a REST API with FastAPI
- Run a development web server with Uvicorn
- Model an SQLite database
- Investigate the auto-generated API documentation
- Interact with the database with CRUD actions
Here are some ideas for additional features:
- Custom URL key: Let your users create custom URL keys instead of a random string.
- Peek URL: Create an endpoint for your users to check which target URL is behind a shortened URL.
- Graceful Forward: Check if the website exists before forwarding.
When you feel ready, then hosting your project on Heroku is a great next step. If you want to make your URL shortener Python project even more user-friendly, then you can consider adding a front end. With a front end, you can provide a nice-looking interface for your users, so they don’t need to know about any API endpoints themselves.
No matter in which direction you take the development of your URL shortener, make sure to promote it in the comments below. Bonus points if you post a shortened link that forwards to your hosted project!
For more information on concepts covered in this video course, check out:
- Using FastAPI to Build Python Web APIs
- Python’s Requests Library (Guide)
- Python’s urllib.request for HTTP Requests
- Python Type Checking (Guide)
- Introduction to Python SQL Libraries
- Data Management With Python, SQLite, and SQLAlchemy
- Refactoring Python Applications for Simplicity
- pydantic documentation
- Uvicorn documentation
- FastAPI documentation
- Swagger UI overview
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.
vigo on Aug. 23, 2022
well, sample code zip file is empty :)