Skip to content

Latest commit

 

History

History
68 lines (44 loc) · 1.46 KB

File metadata and controls

68 lines (44 loc) · 1.46 KB

urlshortener-example

This is demo projcet for yhttp.

Installation

First you need to clone the project or download it directly.

git clone https://github.com/yhttp/urlshortener-example
cd urlshortener-example
pip install .

Or

pip install git+https://github.com/yhttp/urlshortener-example

Deployment

You can use gunicorn to serve our wsgi application.

pip install gunicorn

you can deploy the generator using the following command.

Note: You can bind it to any address of your liking.

cd path/to/urlshortener-example
gunicorn shortener:app --bind localhost:8000

Usage

To use urlshortener-example use the following command to send a your URL to the app.

curl localhost:8000 -X POST -d "url=[some long URL]"

Now take the accquired short URL to make a request to get redirected. You can use a web browser for this part as it's a simple GET request. so simply visit localhost:8000/[short URL].

Now you must be automatically redirected to your original URL.

Tests

Install the necessary packages to contribute or run tests.

pip install -r requirements-dev.txt

We use bddrest to test our project.

Contributing

Pull requests are welcome. Please make sure to update tests as appropriate if you decide to make a pull request.

License

MIT