This project is a web-based blog application that allows users to view, add, and manage blog posts. It includes user authentication, post management, and category features.
This module handles user authentication using MongoDB. It includes functions to initialize the connection, register a new user, and check user credentials for login.
- initialize(): Initializes the MongoDB connection.
- registerUser(userData): Registers a new user, encrypting the password.
- checkUser(userData): Checks user credentials during login.
This module manages blog-related functionalities using Sequelize for PostgreSQL. It includes functions for post and category management.
- initialize(): Initializes the PostgreSQL connection.
- getAllPosts(),
getPublishedPosts()
: Retrieves all or published posts. - getCategories(): Retrieves all categories.
- addPost(postData): Adds a new blog post.
- getPostById(id): Retrieves a blog post by ID.
- getPostsByCategory(category): Retrieves posts by category.
- getPostsByMinDate(minDate): Retrieves posts by minimum date.
- addCategory(categoryData): Adds a new category.
- deleteCategoryById(id): Deletes a category by ID.
- deletePostById(id): Deletes a post by ID.
This is the main server file using Express. It includes routes for handling user requests, rendering views, and interacting with the blog and authentication services.
- Defines routes for handling blog-related operations such as viewing, adding, and deleting posts and categories.
- Implements user authentication and session management.
- Renders views using Handlebars templates.
- Uses Cloudinary for image upload.
- Includes middleware for ensuring user login.
Contains Handlebars templates for rendering HTML views.
Contains Node.js modules and dependencies required for the project.