Wanderlust is a Node.js/Express web application for listing and reviewing travel destinations. Users can create, view, and review listings, with authentication and error handling.
- User authentication (Passport.js & passport-local-mongoose)
- Create, edit, delete, and view travel listings
- Add and delete reviews for listings
- Flash messages for success and error feedback
- Server-side validation with Joi
- MongoDB/Mongoose for data storage
- EJS templating with layouts (ejs-mate)
- RESTful routing and error handling
-
Clone the repository:
git clone https://github.com/Ebadur-Rahman1/wanderlust.git cd wanderlust -
Install dependencies:
npm install
-
Set up MongoDB:
- Make sure MongoDB is running locally on
mongodb://127.0.0.1:27017/wanderlust - Or update the
MONGO_URLinapp.jsto your MongoDB URI
- Make sure MongoDB is running locally on
-
Seed the database (optional):
node init/index.js
-
Start the server:
npm start
or
nodemon app.js
-
Visit in your browser:
http://localhost:8080
majorprojects/
├── app.js
├── models/
│ ├── listing.js
│ ├── review.js
│ └── user.js
├── routes/
│ ├── listing.js
│ └── review.js
├── views/
│ ├── listings/
│ ├── layouts/
│ └── error.ejs
├── public/
├── schema.js
├── utils/
│ ├── ExpressErrors.js
│ └── wrapAsync.js
└── init/
├── index.js
└── data.js
- Validation errors:
Make sure your forms use the correct field names (e.g.,listing[title],review[comment]). - Flash messages not showing:
Ensure you usereturn res.redirect(...)after setting a flash message. - Cannot set headers after they are sent:
Always return after a redirect or response. - "review" or "listing" is required:
Confirm your form structure matches what Joi expects.
Happy coding!