The Travel Tracker application allows users to track the countries they have visited. Built with Node.js, Express, and EJS, this app interacts with a PostgreSQL database hosted on Render to manage country data efficiently.
- Add countries to your visited list by entering the country name.
- Display total number of visited countries on the home page.
- Dynamic user interface that visually highlights the countries visited.
This project relies on the following packages:
- Express: Fast, unopinionated, minimalist web framework for Node.js.
- EJS: Embedded JavaScript templating for rendering HTML views.
- pg: Non-blocking PostgreSQL client for Node.js.
- dotenv: Module for loading environment variables from a
.env
file intoprocess.env
. - body-parser: Middleware for parsing request bodies.
This project utilizes a PostgreSQL database to store country data, including country codes and names, as well as a record of visited countries.
- countries: Stores the country codes and names.
- visited_countries: Records the countries that have been visited by the user.
- Node.js installed on your machine.
- PostgreSQL database (e.g., Render).
Follow these steps to set up the project locally:
-
Clone the repository:
git clone <repository-url> cd <repository-folder>
-
Install dependencies:
npm install
- Create a .env file with your database credentials:
PORT=3000
DB_USER=<your_db_user>
DB_HOST=<your_db_host>
DB_NAME=<your_db_name>
DB_PASSWORD=<your_db_password>
DB_PORT=5432
- Start the server:
node index.js
.
├── public/ # Static assets (CSS, JS, images)
├── views/ # EJS templates
├── config/ # Database configuration
├── .env # Environment variables
├── package.json # Project dependencies
└── index.js # Main server file
Feel free to fork the repository and submit pull requests for any improvements or new features!
This project is licensed under the MIT License.
Replace these:
<repository-url>
<repository-folder>
with the actual URL and name for your project. Add or modify sections as needed based on your project specifics or to include any additional relevant information.