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.
- 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.
- Clone the repository:
git clone https://github.com/Nimabht/Onyx-blogging-website
- Install dependencies:
cd Onyx-blogging-website
npm install
- Setup environment variables in .env file:
DATABASE_URL=
SESSION_SECRET_KEY=
SERVER_PORT=
ADMIN_USERNAME=
ADMIN_PASSWORD=
- Set up the database:
Ensure MongoDB is installed and running.
- Start the server:
npm start
GET /explore
GET /signup
GET /login
GET /dashboard
GET /my-articles
GET /new-story
GET /admin
GET /article/<:articleId>
GET /edit-article/<:articleId>
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. |
POST /api/auth/login
Request Body:
Field | Type | Description |
---|---|---|
username |
string |
Required. |
password |
string |
Required. |
GET /api/auth/logout
POST /api/auth/resetpassword/<:userId>
Request Body:
Field | Type | Description |
---|---|---|
currentPassowrrd |
string |
Required. |
newPassword |
string |
Required. |
GET /api/user
GET /api/user/<:userId>
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 /api/user/<:userId>
GET /api/article
GET /api/article/my-articles
GET /api/article/<:articleId>
POST /api/article
Request Body:
Field | Type | Description |
---|---|---|
title |
string |
Required. |
sketch |
string |
Optional. |
content |
string |
Required. |
PUT /api/article/<:articleId>
Request Body:
Field | Type | Description |
---|---|---|
firstname |
string |
Required. |
lastname |
string |
Required. |
username |
string |
Required. |
gender |
string |
Optional. |
role |
string |
limited. |
PATCH /api/article/update-thumbnail/<:articleId>
Request Body:
Field | Type | Description |
---|---|---|
thumbnail |
file |
Required. |
DELETE /api/article/<:articleId>
GET /api/comment
GET /api/comment/my-comments
GET /api/comment/<:commentId>
POST /api/comment
Request Body:
Field | Type | Description |
---|---|---|
content |
string |
Required. |
articleId |
objectId(string) |
Required. |
PUT /api/comment/<:commentId>
Request Body:
Field | Type | Description |
---|---|---|
content |
string |
Required. |
DELETE /api/comment/<:commentId>