TinyURL is a simple MEVN stack URL shortener.
- HTML/CSS3
- nodeJs
- express
- vue 3
- vue router
- mongoDB
You can install TinyURL locally using npm.
Install dependencies using:
cd front
npm install
Compile and hot-reload for development using:
npm run serve
Compile and minifile for production by running:
npm run build
Install dependencies using:
cd back
npm install
Compiles for development using:
npm run dev
or start the server by using the following command:
npm start
replace your database url in back/.env
file
You can get the original URL using:
GET /short
Parameter | Type | Description |
---|---|---|
URL |
string |
Required. short url |
200 status code return {realURL : string}
get the details about your short url using:
GET /details
Parameter | Type |
---|---|
URL |
string |
200 status code return
{
realURL : String,
os : Object,
machine : Object,
time : Object,
country : Object,
}
shorten the URL:
POST /short
Login is required to request this API. The request should be a JSON in the form of {URL : string}
. Make sure to put Bearer accessToken
in headed.Authorization
.
201 status code return {shortURL : string}
Sign up :
POST /register
The request should be a JSON in the form of
{
user : string,
email : string,
pwd : string
}
201 status code return { "success": 'new user ${user} created!' }
other status code :
Status Code | Description |
---|---|
201 | CREATED |
400 | BAD REQUEST |
409 | Conflict |
500 | INTERNAL SERVER ERROR |
Login to an existing account :
POST /auth
The request should be a JSON in the form of
{
user : string,
pwd : string
}
200 status code return {accessToken : string}
which expires after 30 seconds. The refreshToken is set as a cookie which expires after 1 day.
other status code :
Status Code | Description |
---|---|
200 | OK |
400 | BAD REQUEST |
401 | UNAUTHORIZED |
500 | INTERNAL SERVER ERROR |
To get new accessToken :
GET /refresh
200 status code return {accessToken : string}
other status code :
Status Code | Description |
---|---|
200 | OK |
401 | UNAUTHORIZED |
403 | FORBIDDEN |
500 | INTERNAL SERVER ERROR |
licensed under the MIT License.