Travel app built with NodeJS and Express from scratch using MVC architecture
Live site
ยท
My portfolio
ยท
Table of Contents
Built using modern tech stack and frameworks: NodeJS, Express, MongoDB, Mongoose ๐ This app was built following a course on complete NodeJS development by Jonas S. on Udemy and was adapted as a hobby project.
Lao Tours is a web app built from scratch using exclusively NodeJS, Express and MongoDB. This app was a side project done in vue to understand better the back-end development using modern technologies such as NodeJS. This project was adapted to make it more from an online course. This app allows you to look at tours, sign up, authenticate and book tours using Stripe API.
"Lao Tours" is a fictional booking website for tours in Laos. The website displays various fictional tours in several cities and famous landmarks in Laos, for adventurers and tourists. Laos has a rich history and counts several World Heritage Sites as well as beautiful karst landscapes, witnesses of rich past geologic activity.
This guide is on how to set up the project locally
- nodemon: development tool
- mongoose: communicate with mongodb cloud
- dovenv: using local environment variables
- (optional) node-sass: generating css files
DATABASE
: mongodb endpointDATABASE_PASSWORD
EMAIL_FROM
: email to send it fromJWT_COOKIE_EXPIRES_IN
JWT_EXPIRES_IN
JWT_SECRET
NODE_ENV
SENDGRID_PASSWORD
SENDGRID_USERNAME
STRIPE_PUBLIC_KEY
STRIPE_SECRET_KEY
STRIPE_WEBHOOK_SECRET
- Get a free API Key at https://example.com
- Clone the repo
git clone https://github.com/cedriclemercier/laotours.git
- Install NPM packages
npm install
- (for myself) Enter your environment variables in root folder as
.env
. Example:DATABASE=mongodb+srv://<the-url>
The application follows a classic MVC architecture including:
-
/views
: all the views of the application, using the templating enginepug
-
/models
: our mongodb models for booking, review, tour, and user -
/controllers
: the controllers for user, views, tours, reviews, errors, bookings. -
/util
: utilities, including email constructur, error handling -
/routes
: all routes organised neatly -
/public
: our frontend files
The front end of the application communicates with the backend API endpoints running on the same URL. Add these to the end of the root url for getting data in JSON format. Endpoints include:
/api/v1/tours
: Get all the tours/api/v1/tours/5c88fa8cf4afda39709c2951
: Get a tour by id/api/v1/bookings
: All Bookings (requires log in)/api/v1/tours/5c88fa8cf4afda39709c2951/reviews
: Get all reviews for a tour id/api/v1/users
: Get all users/api/v1/users/signup
: Sign up as a new user/api/v1/users/login
: Log in
// expected payload for sign up
{
"name": "Cedric",
"email": "[email protected]",
"password": "test",
"passwordConfirm": "test"
}
// Expected payload for login
{
"email": "[email protected]",
"password": "test1234"
}
email:edu@example.com
password: test1234
Card info for testing
: 4242 4242 4242 4242- Enter anything the rest of the fields
- You will receive a confirmation email
Your purchased tours will appear in your profle
Distributed under the MIT License. See LICENSE.txt
for more information.
Your Name - @CedricLeMercier - [email protected]
Project Link: https://github.com/cedriclemercier/laotours