Shorty is another free and open source link shortener. The name 'shorty' stands for 'short' or 'turn a long link to a short one'. It's just a personal project to apply what I learned and having fun!
- register new user
- user login
- show list of links assciated with the user account
- add new link
- edit an existing link
- delete an existing link
- React for front-end
- CSS (no frameworks) for styling.
- Node.js and Express for back-end
- MongoDB for databse
- JWT for authentication and authorization
- you can try the app from this demo link: shorty
- otehrwise, you can run it locally by following the next steps:
- make sure Node.js and MongoDB are installed
- clone this repo by running
git clone https://github.com/islam36/shorty.git
- change directory:
cd shorty
- install dependencies:
npm install
- make sure mongodb is running
- create a new database called
shorty
in mongodb - build client:
npm run build
- start server:
npm start
- open your browser on
localhost:8000/
and you should see the web app running
method | route | request body | description |
---|---|---|---|
POST |
/api/users |
username, password |
create a new user. The username must be unique and the password length must be at least 6 characters. |
GET |
/api/users/:userId |
/ | returns the the data of user whose 'id' is 'userId'. Requires authentication. Only return the data of the authenticated user |
PUT |
/api/users/:userId |
username, password |
Requires authentication. Edit the data of the user whose 'id' is 'userId' |
DELETE |
/api/users/:userId |
/ | Requires authentication. Delete the user whose 'id' is 'userId' |
POST |
/api/auth/login |
username, password |
authenticate a user. Returns the user data and a JWT token used to authorize the user to perform actions that require authentication on the app. |
GET |
/api/links |
/ | Requires authentication. Returns an array of links which are associated with the authenticated user. It also supports pagination using page and limit request queries. |
POST |
/api/links |
title, link |
Requires authentication. Create a new link. Returns the created link with the short link associated to it. |
GET |
/api/links/:linkId |
/ | Requires authentication. Returns the data of the link whose 'id' is 'linkId' |
POST |
/api/links/:linkId |
title, link |
Requires authentication. Edit the link whose 'id' is 'linkId'. |
DELETE |
/api/links/:linkId |
/ | Requires authentication. Delete the link whose 'id' is 'linkId' |
any contribution with code, idea, review, feedback is welcome. Just make a pull request and we'll discuss about it.