Giter Site home page Giter Site logo

cedriclemercier / laotours Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 84.74 MB

An API and website with Authentication, booking, payment and emails. Using NodeJS, Express, MongoDB, Mongoose

Home Page: http://laotours.herokuapp.com

JavaScript 94.11% HTML 1.51% CSS 1.21% Pug 1.92% SCSS 1.25%

laotours's Introduction


Logo

Lao Tours

Travel app built with NodeJS and Express from scratch using MVC architecture
Live site ยท My portfolio ยท

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Architecture
  5. Endpoints
  6. License
  7. Acknowledgments

About The Project

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

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.

(back to top)

Built With

(back to top)

Getting Started

This guide is on how to set up the project locally


Prerequisites

Packages

  • nodemon: development tool
  • mongoose: communicate with mongodb cloud
  • dovenv: using local environment variables
  • (optional) node-sass: generating css files

Environment variables (for development)

  • DATABASE: mongodb endpoint
  • DATABASE_PASSWORD
  • EMAIL_FROM: email to send it from
  • JWT_COOKIE_EXPIRES_IN
  • JWT_EXPIRES_IN
  • JWT_SECRET
  • NODE_ENV
  • SENDGRID_PASSWORD
  • SENDGRID_USERNAME
  • STRIPE_PUBLIC_KEY
  • STRIPE_SECRET_KEY
  • STRIPE_WEBHOOK_SECRET

Installation

  1. Get a free API Key at https://example.com
  2. Clone the repo
    git clone https://github.com/cedriclemercier/laotours.git
  3. Install NPM packages
    npm install
  4. (for myself) Enter your environment variables in root folder as .env. Example:
    DATABASE=mongodb+srv://<the-url>

(back to top)

Architecture

Folder Organisation

The application follows a classic MVC architecture including:

  • /views: all the views of the application, using the templating engine pug

  • /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


Endpoints

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"
}

Postman API Documentation

Postman API Documentation

(back to top)

Usage

Log in with an example user

email:edu@example.com
password: test1234


Book a tour


Purchase with Stripe

  • 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

Admin view


License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Your Name - @CedricLeMercier - [email protected]

Project Link: https://github.com/cedriclemercier/laotours

(back to top)

Acknowledgments

(back to top)

laotours's People

Contributors

cedriclemercier avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.