Skip to content

CodeBeginner000001/NodeJs_Blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NodeJs Blog

Screenshot 2024-08-31 at 9 29 03 PM

Welcome to the NodeJs Blog repository! This project is a simple yet powerful blogging platform built using Node.js, Express, MongoDB, and EJS. It allows users to create, view, edit, and manage blog posts. The platform also includes an admin dashboard for managing content and offers standard static pages like About and Contact.

Table of Contents

  1. Project Overview
  2. Features
  3. File Structure
  4. Installation
  5. Usage
  6. Authentication
  7. Final View
  8. Contributing

Project Overview

The NodeJs Blog platform is designed for simplicity and ease of use. It's perfect for anyone looking to set up a quick and efficient blog. The backend is built with Node.js and Express, with MongoDB handling data storage. EJS is used as the templating engine to render dynamic content on the frontend.

Main Features:

  • Post Creation & Viewing: Users can view blog posts on the homepage, and admins can create new posts.
  • Static Pages: Includes an About page and a Contact page for additional site information.
  • Admin Dashboard: Admins can log in to access a dashboard where they can manage all blog posts, including creating, editing, and deleting posts.
  • Secure Authentication: Admin sessions are managed securely with a token-based authentication system and cookies.

File Structure

The project is organized into several key directories and files:

nodejs-blog/
├── views/
│   ├── admin/
│   │   ├── add-post.ejs
│   │   ├── dashboard.ejs
│   │   ├── edit-post.ejs
│   │   └── index.ejs
│   ├── layouts/
│   │   ├── main.ejs
│   │   └── admin.ejs
│   ├── partials/
│   │   ├── footer.ejs
│   │   ├── header_admin.ejs
│   │   ├── header.ejs
│   │   └── search.ejs
│   ├── about.ejs
│   ├── contact.ejs
│   ├── home.ejs
│   ├── post.ejs
│   └── search.ejs
├── public/
│   ├── css/
│   │   └── style.css
│   ├── images/
│   │   ├── Blog-logo.png
│   │   ├── Hero Images.png
│   │   ├── img-noise-361x370.png
│   │   ├── instagram-logo.png
│   │   ├── Linkedin-logo.png
│   │   ├── search.png
│   │   └── X-logo.png
│   └── js/
│       └── script.js
├── server/
│   ├── config/
│   │   └── MongoDB.js
│   ├── helpers/
│   │   └── routeHelpers.js
│   ├── models/
│   │   ├── Post.js
│   │   └── User.js
│   └── routes/
│       ├── admin.js
│       └── main.js

Installation

To get started with the NodeJs Blog, follow these steps:

  1. Clone the repository:

    git clone https://github.com/yourusername/nodejs-blog.git
    cd nodejs-blog
  2. Install dependencies:

    npm install
  3. Set up your MongoDB connection:

    • Update the MongoDB connection details in config/MongoDB.js.
  4. Start the application:

    npm run start

Usage

  • Homepage: View all blog posts available on the platform.
  • Admin Access: Admins can log in to the dashboard to create, edit, or delete blog posts.
  • Static Pages: Learn more about the blog on the About page or reach out via the Contact page.

Authentication

The application employs a secure token-based authentication system that utilizes cookies to manage admin sessions. Here’s how it works:

  • Login Process: When an admin logs in, a token is generated and stored as a cookie in the admin's browser. This token authenticates the admin and grants access to the dashboard and other restricted functionalities.
  • Session Management: The token in the cookie is checked on each request to ensure that the user is authenticated. If the token is valid, the user is allowed access to admin features; if not, they are redirected to the login page.
  • Security: The use of tokens and cookies ensures that only authenticated users can manage the blog's content, adding an essential layer of security to the platform.

Final View

Latest Post Page

Screenshot 2024-08-31 at 9 29 13 PM


About Page

Screenshot 2024-08-31 at 9 29 25 PM


Contact Page

Screenshot 2024-08-31 at 9 29 45 PM


Admin Login Page

Screenshot 2024-08-31 at 9 30 04 PM


Admin Panel Page

Screenshot 2024-08-31 at 9 30 26 PM


View/Edit Page

Screenshot 2024-08-31 at 9 30 36 PM


Add New Post Page

Screenshot 2024-08-31 at 9 30 48 PM


Contributing

Contributions are always welcome! If you'd like to contribute to the project, please fork the repository and submit a pull request with your changes.


About

NodeJs Blog is built using Backend only where it is created using MongoDb, Express, NodeJs, EJS

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors