Skip to content

Nimabht/Onyx-blogging-website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Onyx blogging website

This is a full-stack blogging website built with Express.js and EJS, using MongoDB for the database. It provides a platform for users to read and write articles, post comments, and interact with other users. The project also includes an admin panel for managing users, comments, and articles.

Features

  • User Registration and Authentication: Users can create accounts, log in, and log out securely.
  • Article Management: Registered users can create, edit, and delete their articles.
  • Commenting System: Users can post comments on articles, fostering discussions.
  • User Profile: Each user has a personalized profile page that showcases their articles and comments.
  • Explore Page: Users can browse and read articles without the need for authentication.
  • Admin Panel: The admin panel allows authorized users to manage users, comments, and articles efficiently.

Installation

  1. Clone the repository:
git clone https://github.com/Nimabht/Onyx-blogging-website
  1. Install dependencies:
cd Onyx-blogging-website
npm install
  1. Setup environment variables in .env file:
DATABASE_URL=
SESSION_SECRET_KEY=
SERVER_PORT=
ADMIN_USERNAME=
ADMIN_PASSWORD=
  1. Set up the database:

Ensure MongoDB is installed and running.

  1. Start the server:
npm start

Pages (Client side)

Explore page

  GET /explore

Signup page

  GET /signup

Login page

  GET /login

Dashboard page

  GET /dashboard

My articles page

  GET /my-articles

Write new article page

  GET /new-story

Admin panel page

  GET /admin

Read article page

  GET /article/<:articleId>

Modify article page

  GET /edit-article/<:articleId>

API Reference

Authentication

Signup

  POST /api/auth/signup

Request Body:

Field Type Description
firstname string Required.
lastname string Required.
username string Required.
gender string limited.
password string Required.
repeat_password string Required.
role string Forbidden.

Login

  POST /api/auth/login

Request Body:

Field Type Description
username string Required.
password string Required.

Logout

  GET /api/auth/logout

Reset password

  POST /api/auth/resetpassword/<:userId>

Request Body:

Field Type Description
currentPassowrrd string Required.
newPassword string Required.

User

Get all users

  GET /api/user

Get user by ID

  GET /api/user/<:userId>

Update user

  PUT /api/user/<:userId>

Request Body:

Field Type Description
firstname string Required.
lastname string Required.
username string Required.
gender string Optional.
role string limited.

Delete user by ID

  DELETE /api/user/<:userId>

Article

Get all articles

  GET /api/article

Get articles that owned by user

  GET /api/article/my-articles

Get article by ID

  GET /api/article/<:articleId>

Create a new article

  POST /api/article

Request Body:

Field Type Description
title string Required.
sketch string Optional.
content string Required.

Update article

  PUT /api/article/<:articleId>

Request Body:

Field Type Description
firstname string Required.
lastname string Required.
username string Required.
gender string Optional.
role string limited.

Upload article thumbnail

  PATCH /api/article/update-thumbnail/<:articleId>

Request Body:

Field Type Description
thumbnail file Required.

Delete article by ID

  DELETE /api/article/<:articleId>

Comment

Get all comments

  GET /api/comment

Get comments that owned by user

  GET /api/comment/my-comments

Get comment by ID

  GET /api/comment/<:commentId>

Create a new comment

  POST /api/comment

Request Body:

Field Type Description
content string Required.
articleId objectId(string) Required.

Update comment

  PUT /api/comment/<:commentId>

Request Body:

Field Type Description
content string Required.

Delete commnet by ID

  DELETE /api/comment/<:commentId>

Stay in touch

Authors

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published