Giter Club home page Giter Club logo

sreddy-96 / campsiteexplorer Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.04 MB

A campsite directory for people to add, edit and delete there own campsites, also the ability to review using comments and a star rating system. Including cluster and pinpoint maps. Formally - YelpCamp

Home Page: https://yelpcamp-khiq.onrender.com

License: MIT License

JavaScript 86.18% CSS 4.91% EJS 8.91%
bootstrap cloudinary css ejs expressjs html javascript joi mongodb mongoose nodejs passport

campsiteexplorer's Introduction

CampsiteExplorer

Description

A campsite directory for users to add, edit and delete there own campsites. Also, the user has the ability to review other campgrounds using comments and a star rating system. The use of cluster and pinpoint maps makes it easier for the user to located the campgrounds.

WHY?

This project was developed as part of a web developer's boot camp, providing me with an opportunity to apply the programming languages I had been learning, such as HTML, CSS, JavaScript, Node.js, and Express.js, in a practical setting. It offered valuable insights into working with APIs and implementing security measures for web applications. By integrating a non-SQL database, I gained hands-on experience with CRUD (Create, Read, Update, Delete) operations and their application in a real-world scenario

Model

Home

Leveraging EJS (Embedded JavaScript) templates, I created a boilerplate layout that could be reused across multiple pages, maintaining a consistent theme throughout the application. This approach streamlined the coding process, making it more manageable. Additionally, I utilized the CSS linear-gradient function to soften the background image, resulting in a more inviting and visually appealing user interface. The home page was intentionally kept simple and straightforward, enhancing the user experience and ensuring easy navigation

Campgrounds

The campground page serves as the central hub of the website, where users can view a list of campgrounds and their corresponding locations on a cluster map powered by MapBox. This page displays essential information about each campground, including the title, description, and location, providing users with a comprehensive overview.

The campground data is stored in a MongoDB database. Through a GET request and the use of the catchAsync utility, the campgrounds are fetched and rendered on the page. An if statement is employed using EJS to iterate over the campground collection, dynamically generating a div element for each campground entry.

The cluster map is a valuable addition to the site, as it allows users to visually pinpoint the geographic locations of the campgrounds. The location data, stored alongside other campground information, is converted into longitude and latitude coordinates, enabling the precise plotting of campground markers on the map.

New Campgrounds

To access the 'New Campground' feature, users must be authenticated and logged in. This access control is implemented through Express Session, which checks the user's login status. If the user is not logged in, Connect Flash is utilized to display a flash card with an error message, redirecting the user to the login page.

Multer middleware is employed to validate form input and prevent potential security attacks. This middleware also simplifies the process of accepting image uploads by handling the image data and storing it in Cloudinary, with the corresponding image ID saved in the database table.

Bootstrap, a popular CSS framework, was instrumental in streamlining the styling and positioning of the form elements. It also enhanced the user experience by providing visual cues for unfilled or invalid form inputs, ensuring a smoother and more intuitive form submission process.

Log In

The Bootstrap card component was utilized to create a professional and clean layout for the form, taking advantage of Bootstrap's form styling capabilities. This framework provided visual cues and alerts to users in case of any input mistakes, enhancing the overall user experience.

Mongoose was employed to define the Schema, which enforced data validation and ensured correct input into the form fields. Passport, an authentication middleware, was used to validate the user's input after the POST request. It cross-referenced the provided details with the data stored in the application. If the validation failed, Express and Connect Flash handled the error by displaying an appropriate message. However, if the validation succeeded, the user was redirected to the Campgrounds page, allowing them to continue browsing and interacting with the application.

Register

Leveraging the Bootstrap styling from the login page, I maintained a consistent design across both the login and registration pages, ensuring a cohesive user experience.

The same Mongoose Schema used for the login page was employed for the registration form, enabling data validation and preventing potential security vulnerabilities. Passport, in conjunction with Mongoose, verified the user's input against the defined Schema. Upon successful validation, the user's data was securely stored in the MongoDB database.

Express Sessions played a crucial role in maintaining the user's authenticated state, allowing them to browse the application without interruption. After successful registration, the user was seamlessly redirected to the Campgrounds page, where they could continue exploring and interacting with the site's features.

Campground

The Show Campground page provides users with comprehensive details about a specific campground, including its name, location (displayed on a small MapBox map), description, author, and price. This page serves as a central hub for accessing and interacting with the campground's information.

Leveraging Express Sessions and Mongoose, users who are the authors of a particular campground have the ability to edit or delete that campground from the site. Similarly, users who have submitted reviews for a campground can also edit or delete their own reviews.

Joi Schemas play a crucial role in securing the application by validating user input and preventing potential security attacks. This validation process helps to identify and block any harmful data that users may attempt to input.

Utilizing EJS and if statements, the application iterates over the campground's images and seamlessly displays them in a Bootstrap carousel. The remaining campground data is dynamically rendered within an empty div element, ensuring a consistent display and styling across the site, maintaining a cohesive user experience.

Problems encountered

  • Getting to grips with MapBox and API's.
  • Setting up Schemas correctly.
  • Handling user input.
  • Import and exporting files correctly.

New skills

  • Working with GeoAPI.
  • Understanding the importance of Passport and its uses.
  • Working with a Non-SQl database.
  • Setting up and understanding EJS.
  • Creating an Express application.

languages

  • Javascript
  • HTML
  • CSS
  • Node.js
  • Frameworks:
    • Bootstrap
    • Express.js
    • EJS
  • Other Dependencies:
    • MongodDB
    • Mongoose
    • Cloudinary
    • Joi
    • Passport

Running Locally

Running Web Page

  • Make sure to have Flask and Python installed before proceeding.

Clone the repository:

git clone https://github.com/SReddy-96/CampsiteExplorer

Navigate into directory:

cd CampsiteExplorer

Install Dependencies:

npm install

Run the Application:

npm start

Open your web browser and navigate to http://localhost:3000 to access CampsiteExplorer.

Usage

Once the application is running, users can:

  • Create an account.
  • Search for campsites using the search functionality.
  • View details about each campsite by clicking on its listing.
  • Contribute by adding new campsites using the provided form.

campsiteexplorer's People

Contributors

sreddy-96 avatar

Watchers

 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.