aagaard / url_shortener_api

Simple REST API to shorten a URL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

URL shortener API

A simple REST API to shorten a URL using FastAPI ⚡️.

Getting Started

Prerequisites

It is assumed the following packages are installed before using HomeBrew on macOS:

brew install curl python@3.9

With Python3.9 in the PATH, run the following to install Poetry (a package and dependency manager):

curl -sSL https://install.python-poetry.org | python -

Prepare and install the environment

Clone the project:

git clone https://github.com/aagaard/url_shortener_api

To configure poetry to install the virtual environment in the project and install the project inside the virtual environment

poetry config settings.virtualenvs.in-project true
poetry install

Start the server

Run the web application in "production" mode (be aware the server is publicly available):

poetry run app/main.py

To run the web application in developer mode (reloads application for every file change):

poetry run uvicorn app.main:app --reload

To run tests

poetry run pytest

Interactive use of API provided by Swagger

Go to http://127.0.0.1:8000/docs

About

Simple REST API to shorten a URL


Languages

Language:Python 100.0%