A simple URL shortener application built with FastAPI and SQLAlchemy.
$ git clone https://github.com/[YOUR_GITHUB_USERNAME]/fastapi-url-shortener.git$ cd fastapi-url-shortener$ poetry install- Make a copy of the
.env.examplefile and rename it to.env - Open the newly created
.envfile in a text editor. - Replace the placeholder values in the
.envfile with your own desired values. - Save the changes to the
.envfile.
It is important to note that the values in the .env file should not be shared publicly, as they may contain sensitive information such as secret keys.
$ poetry run uvicorn main:app --reloadYou can now access the app at http://localhost:8000 (or hostname that you specified in .env file)
The following endpoints are available:
POST /url: Create a new shortened URL.GET /{url_key}: Redirect to the target URL for the specified shortened URL key.GET /admin/{secret_key}: Get information about the specified shortened URL.DELETE /admin/{secret_key}: Delete the specified shortened URL.