This is a Node.js application that demonstrates the usage of Google Maps API to display a map with route directions and markers. The application provides an interactive interface to enter origin and destination addresses and generates a route between them.
To set up the project, follow these steps:
- Clone the repository to your local machine.
git clone https://github.com/mibalbert/Parcelino.git
- Navigate to the project directory.
cd Parcelino
- Install the dependencies using npm.
npm install
-
Create a Google Maps API key by following the official documentation.
-
Replace the placeholder API key in the following line of code with your own API key:
The file where this is found is at public/js/home.js
script.src = "https://maps.googleapis.com/maps/api/js?key=****YOUR_API_KEY****&libraries=places,geometry&callback=initMap";
To run the application, execute the following command:
npm start
This will start the Node.js server and make the application available at http://localhost:8000
.
-
Open a web browser and navigate to
http://localhost:8000
. -
The application will load the Google Maps API and display a map with route directions.
-
Click on the menu button to toggle the visibility of the menu.
-
Enter the origin and destination addresses in the respective input fields.
-
As you type, the application will provide autocomplete suggestions based on the input.
-
Select the desired address from the autocomplete suggestions for both origin and destination.
-
The application will update the map and display the route between the two locations, along with markers.
-
You can resize the window to see the responsive behavior of the map.
This project also provides Docker support for easy deployment and containerization.
- Docker: Install Docker
To build and run the application using Docker, follow these steps:
- Build the Docker image.
docker build -t project-name .
- Run the Docker container.
docker run -p 8000:8000 project-name
- Access the application through the browser at http://localhost:8000.
Alternatively, you can use Docker Compose to manage the application and its dependencies.
- Build and start the Docker services.
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d // For development
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d // For production
-
Access the application through the browser at http://localhost:8000.
-
Stop the Docker services when done.
docker-compose down -v
This project utilizes the following technologies and libraries:
Node.js Express.js Google Maps API Docker
This project is licensed under the MIT License.