This project is a Laravel-based application for creating short urls
git clone https://github.com/ktsouvalis/shortnest.git
cd shortnest
composer install --no-dev
Copy the example environment file and set up your environment variables:
copy .env.example .env
php artisan key:generate
Inside the .env
file, set your database connection details for your running MySQL Server, your application's desired name, your application's url.
Run the database migrations to set up the necessary tables:
php artisan migrate
curl -X POST 'http://your-domain.com/api/register' \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]"}'
2. After registering, user must verify their email clicking on the link sent to the registered email.
curl -X POST 'http://your-domain.com/api/shorten' \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"original_url": "https://example.com"}'
curl -X GET 'http://localhost:8000/api/urls' \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
curl -X GET 'http://localhost:8000/api/urls?api-token=YOUR_ACCESS_TOKEN'
You can also use your browser to see the details of all your URLs by visiting:
http://localhost:8000/api/urls?api-token=YOUR_ACCESS_TOKEN
curl -X GET 'http://localhost:8000/api/urls/your-url-id' \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
curl -X GET 'http://localhost:8000/api/urls/your-url-id?api-token=YOUR_ACCESS_TOKEN'
You can also use your browser to see the details of a shortened URL by visiting:
http://localhost:8000/api/urls/your-url-id?api-token=YOUR_ACCESS_TOKEN
curl -X DELETE 'http://your-domain.com/api/shorten' \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
All routes are protected to interact only with the token authenticated user's Urls
The project is licensed under the MIT license.