This project is a URL shortener application built with Node.js, Express.js, Apache, and MongoDB. It allows you to create custom word/hyphenated word mappings to websites and automatically redirects the browser to the corresponding URL when the custom word is entered.
Before running the application, make sure you have the following dependencies installed:
- Node.js and npm (Node Package Manager)
- Apache web server
- MongoDB
-
Clone the repository:
git clone https://github.com/your-username/url-shortener.git
-
Navigate to the project directory:
cd url-shortener
-
Install and configure the Apache web server on your machine. Refer to the Apache documentation for detailed instructions.
-
Edit the Apache configuration file (httpd.conf) and enable the necessary modules, including mod_rewrite and mod_proxy. Make sure the virtual host configuration is set up properly to allow URL rewriting and proxying.
-
Restart the Apache server to apply the changes.
-
Start the Node.js server:
node server.js
-
Edit the Apache configuration file (httpd.conf) and enable the necessary modules, including mod_rewrite and mod_proxy. Make sure the virtual host configuration is set up properly to allow URL rewriting and proxying.
-
Eestart the Apache server to apply the changes.
-
Use the provided HTML form on the homepage (http://localhost:3000) to create new URL mappings.
-
Enter a custom word and the corresponding website URL, then click "Create" to create a mapping.
-
Test the mappings by entering the custom word in the browser's address bar. The browser should automatically redirect to the corresponding website URL.
In order for the server to modify the "hosts" file, make sure to provide write access to the file. On Windows, you can do this by right-clicking the hosts file and selecting "Properties". Then, go to the "Security" tab and add write permissions for the appropriate user or group.
-
Install the node-windows package globally:
npm install -g node-windows
-
Create a Windows service for the Node.js application:
node-windows --install
-
Start the service:
node-windows --start
The Node.js application will now run as a Windows service, starting automatically whenever your computer starts.
This project is licensed under the GNU License - see the LICENSE.md file for details.