Coder Social home page Coder Social logo

blogging-assignment's Introduction

Blogging-assignment

A simple blogging system with user registration, authentication, user roles, blog post management, and user profiles.

Getting Started

Prerequisites

Before running the project, make sure you have the following installed:

  • Node.js and npm (Node Package Manager)
  • MongoDB

Installation

  1. Clone the repository: git clone https://github.com/Neerajonwal/Blogging-assignment.git cd Blogging-assignment

    Install server dependencies: npm install

    Set up your MongoDB database and update the connection string in server/config/config.js.

    Start the server and client npm start or nodemon app.js

Features:- User Registration and Authentication User Roles: User and Admin Blog Post Management User Profiles Secure JWT-based Authentication MongoDB Database Proper Input Validation and Sanitization

Usage:- Authentication Users can register with their email and password. Users can log in securely using their credentials. Authentication is handled using JWT (JSON Web Tokens).

Endpoints :- Use tools like Postman to test the following endpoints: User Registration: POST /auth/register Body:{ "email": "[email protected]", "password": "password123" } User Login: POST /auth/login Body: { "email": "[email protected]", "password": "password123" } Create a Blog Post (Authenticated):

POST /blog/create Headers: Authorization: Bearer Body:{ "title": "My First Blog Post", "content": "This is the content of my first blog post." } Get All Blog Posts: GET /blog/all Delete a Blog Post (Admin Only):

DELETE /blog/:postId Headers: Authorization: Bearer Get User Profile:

GET /user/:userId Headers: Authorization: Bearer Edit User Profile:

PATCH /user/edit/:userId Headers: Authorization: Bearer Body:{ "email": "[email protected]" }

User Roles Two user roles: User and Admin. New users have the role User by default. Admins can view all blog posts and delete any blog post.

Database MongoDB is used to store user data and blog posts. Mongoose is used for schema modeling and interacting with the database. Schemas for users and blog posts are defined in server/models.

Security Proper validation and sanitization of user input are implemented to prevent security vulnerabilities. User authentication is handled using JWT (JSON Web Tokens). Error handling and input validation are in place to enhance security.

Troubleshooting If you encounter any issues while setting up or using the blogging system, please contect me 9549850187 for possible solutions. i will do my best to assist you.

blogging-assignment's People

Contributors

neerajonwal avatar sanskaribalak123 avatar staykr990 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.