Furious with copy pasting long URLs? Fret Not! With miniUrl, you can generate short and sweet URLs with the click of a button!
- Type or copy-paste the URL of your choice into the text box. Make sure the URL is of either http:// or https:// protocol. E.g.
https://www.twitch.com
, and notwww.twitch.com
- Click SUBMIT
- Click your newly generated MiniURL, or copy it to save somewhere else!
Note: If it takes awhile to generate the URL on the website, do wait for about a minute as Render sets a response delay when the app has been inactive.
- The user must include http:// or https:// in their URL
A client-server architecture was utilized
- Users will interact with the React UI frontend, inputting their URL
- URL is sent to Node.js backend, where it will be processed.
- [Extension] The URL is stored in a MongoDB database to ensure consistency in MiniURLs
- Generated/retreived MiniURL is sent back from backend, appearing in the UI for the user to click/copy
- Ensure you have the latest version of Node.js installed in your system.
- Create a MongoDB Atlas account here.
- Stable internet connection.
-
Create a new folder and navigate to its location on the terminal.
-
Initialize new git repo with
git init
. -
Clone the repo from the github repository into your folder.
-
Navigate to the
/client
folder with the commandcd client
. -
Run
npm i
to install libaries used for React. -
While still in the
client
folder, create a new.env
file to store environment variables used in the application. -
In the
.env
file, add the following line:REACT_APP_CONN_URL=http://localhost:3333
-
If all goes well, run
npm start
to begin running the -
Next, navigate to the
/server
folder by runningcd ../server
. -
Similar to step 5, run
npm i
to install dependencies used. -
Add
.env
file with the following lines:MONGO_URI=<connection>
CONN_URL=http://localhost:3000
SERVER_URL=http://localhost:3333
where connection is the connection string given for your MongoDB Atlas cluster.
- If all goes well, run the command
node index.js
to begin running your server. The image below would be what you should see if the server is established correctly.
- To the code, enter the
/server
file and runnpm test
Q: Where do I find the connection string?
A: In the database page, click connect, followed by Connect your application.
Q: I get Network Error after clicking submit, what do I do?
A: Check if your node server is running.
Q: I am unable to establish connection with MongoDB Atlas, what do I do?
A: Ensure that you have used the correct username and password in the connection string. Navigate to Database Access and ensure the user is an atlasAdmin. If there are still issues, navigate to Network Access and ensure your current IP address is added. School / organization networks might block port connection to MongoDB, hence I recommend using hotspot or your home wifi router to run the code.