A Node.js web application for browsing vacation rental listings built with Express, MongoDB, and EJS.
- Browse all vacation rental listings
- View detailed information for individual listings
- Responsive design with modern UI
- MongoDB database integration
- Sample data included
Before running this application, make sure you have the following installed:
- Node.js (version 14 or higher)
- MongoDB (running locally on port 27017)
- npm (comes with Node.js)
-
Clone or download the project files
-
Install dependencies:
npm install
-
Start MongoDB: Make sure MongoDB is running on your local machine. If you haven't installed MongoDB, you can download it from mongodb.com.
-
Initialize the database with sample data:
npm run init-db
-
Start the application:
npm start
Or for development with auto-restart:
npm run dev
Once the application is running:
- Open your web browser and go to
http://localhost:8080 - Click on "All Listings" or go to
http://localhost:8080/listingsto see all vacation rentals - Click on any listing to view its details
npm start- Start the applicationnpm run dev- Start the application with nodemon (auto-restart on file changes)npm run init-db- Initialize the database with sample data
Wonderlust/
├── app.js # Main application file
├── package.json # Dependencies and scripts
├── models/
│ └── listing.js # MongoDB schema for listings
├── views/
│ └── listings/
│ ├── index.ejs # All listings page
│ └── show.ejs # Individual listing page
└── init/
├── data.js # Sample data
└── index.js # Database initialization script
Each listing contains:
title- Property titledescription- Property descriptionimage- Object withfilenameandurlprice- Price per nightlocation- City/locationcountry- Country
- Make sure MongoDB is running on
localhost:27017 - Check if the MongoDB service is started
- Verify your MongoDB installation
- The application runs on port 8080 by default
- If the port is busy, you can change it in
app.js
- Run
npm run init-dbto populate the database with sample data - Check the MongoDB connection in the console
- Backend: Node.js, Express.js
- Database: MongoDB with Mongoose ODM
- Template Engine: EJS
- Frontend: HTML, CSS, JavaScript
ISC