This document has been authored by referencing the content provided in the backendinfo.txt
and frontendinfo.txt
files. For more comprehensive information about the project, kindly consult those aforementioned files.
This project is a URL shortener application built using Django for the backend and React for the frontend. It allows users to shorten long URLs and access them via the generated short URLs. The application also features jwt based user authentication, private routes.
Homepage of this application contains link to url-shortener, jwt token details (for project demonstration), logout feature.
You can copy and paste the URL you wish to shorten, and the resulting shortened URL can then be utilized to access the original page.
-
Create the Django project and app:
django-admin startproject backend python manage.py startapp application
-
Install required packages:
pip install django djangorestframework djangorestframework-simplejwt django-cors-headers
JWT token pair
-
Configure CORS: In
settings.py
, setCORS_ALLOW_ALL_ORIGINS = True
to enable communication between the frontend and backend. -
Set up models, authentication, and URL endpoints according to the backend information provided.
-
Create the React app:
npx create-react-app frontend
-
Install required packages:
npm install react-router-dom jwt-decode
-
Set up components, context, pages, and utils directories as described.
-
Configure private routes and token management using the information provided.
-
Activate the virtual environment:
venv/Scripts/activate
-
Run the backend server:
python manage.py runserver
-
Navigate to the frontend directory:
cd frontend
-
Run the frontend development server:
npm start
- Backend API: http://127.0.0.1:8000/api/
- Token Obtain: http://127.0.0.1:8000/api/token/
- Token Refresh: http://127.0.0.1:8000/api/token/refresh/
- User Registration: http://127.0.0.1:8000/register/registeruser/
- URL Shortener: http://127.0.0.1:8000/register/shorten/
- Access the frontend at
http://localhost:3000
. - Register or log in with an existing account.
- Use the URL shortener to generate short URLs for long URLs.
- Access private routes to view and manage your notes.
This project is licensed under the MIT License.
- Programming Assistance: Documentations, Youtube, Stackoverflow, ChatGPT
- Text/Document Refactoring: ChatGPT
- Aesthetic/UI Support: ChatGPT