- npm install / yarn install
- Modify
.env
file, note that React is using HashRouter for routing, so you have to add/#
end of WEBSITE_URL variable (for example: http://localhost:3000/#).
- npm / yarn start
- npm run build / yarn run build
POST /api/url
- Create new short url.
{
"url": "https://yourlink.com"
}
{
"date": "2021-07-04",
"originalUrl": "https://yourlink.com",
"id": "kE4WEp8Dm",
"shortUrl": "https://shortener.url/kE4WEp8Dm",
"generatedBy": "60e189de06155500153a48a7"
"visitors": [],
"uniqueVisitors: [],
"status": "active",
}
GET /api/url/:id
- Redirect to original url and add user to visitors massiveGET /api/statistics/:id
- Returns url information by it's idGET /api/urls/me
- Returns all my generated urls.GET /api/role/:id
- Returns user role for given url (for example: admin || user)PUT /api/url/edit
- Update status of URL
{
"id": "kE4WEp8Dm",
"status": "pause",
}
GET /api/visited
- Returns all visited urls for user, including removed ones.
User is created by IP Address. if you will generate new link, system will automatically create user with your IP Address, for example if your IP Address is 92.156.133.21, system will generate user like this:
{
"ip": "92.156.133.21",
"visitedLinks: [],
}
- Finds User IP Address
- Looks up for user location by it's IP Address
- Parses user-agent header and get's information about what OS and browser is user using
- Checks if user is in uniqueVisitors massive.
- Returns original url.