This project is a simple URL shortener service built with Node.js, Express.js, and MongoDB. Users can submit lengthy URLs to be transformed into shorter versions. The service provides user registration, login, and secure access using JSON Web Tokens (JWT).
Before running the project, make sure to install the required dependencies:
-
Clone the repository:
git clone https://github.com/chaudhari014/url_shortener.git
-
Install the required dependencies:
npm install
-
Start the development server:
npm run server
-
Access Code Converter in your browser at
http://localhost:8060
.
To register, provide an email and password.
After registration, use your email and password to log in. The server will respond with a JWT (JSON Web Token). Include this token in the headers of your requests for secure access.
#Shorten a URL
Send a POST
request to /shorten
with the original URL in the request body. The server will generate a short URL for you.
To retrieve the original URL, send a GET
request to /:shortUrl
. Replace :shortUrl with the short URL you received when shortening.