An open API service indexing awesome lists of open source software.

https://github.com/pintu544/assignment-submission-portal

A Node.js and Express-based backend application for managing assignments between users and admins.
https://github.com/pintu544/assignment-submission-portal

expressjs mongodb nodejs typescript

Last synced: about 2 months ago
JSON representation

A Node.js and Express-based backend application for managing assignments between users and admins.

Awesome Lists containing this project

README

        



Assignment Management System


A Node.js and Express-based backend application for managing assignments between users and admins.


Features



  • User and Admin registration and login

  • User can upload assignments tagged to specific admins

  • Admins can view, accept, or reject assignments

  • Middleware for authentication and role-based authorization

  • MongoDB as the database with Mongoose for modeling




Prerequisites


Before running this project, ensure you have the following installed:





Installation




  1. Clone the repository:


    git clone https://github.com/pintu544/assignment-submission-portal
    
    cd assignment-submission-portal`



  2. Install dependencies:


    bash


    npm install




  3. Set up environment variables: Create a .env file in the root directory and add the following:


    env


    PORT=5000 MONGO_URI=mongodb://localhost:27017/assignmentDB JWT_SECRET=jwt_secret_key




  4. Start the server:


    bash


    npm run dev




The server will run at http://localhost:5000.




API Endpoints


User Routes


Method


Endpoint


Description


POST


/user/register


Register a new user


POST


/user/login


Login as a user


POST


/assignment/upload


Upload a new assignment


Admin Routes


Method


Endpoint


Description


POST


/user/register


Register a new admin


POST


/user/login


Login as an admin


GET


/admin/assignments


Get all assignments


POST


/admin/assignments/:id/accept


Accept an assignment by ID


POST


/admin/assignments/:id/reject


Reject an assignment by ID




Sample Payloads


User Registration


Endpoint: POST /user/register


json


{ "name": "John Doe", "email": "[email protected]", "password": "password123" }


Upload Assignment


Endpoint: POST user/assignment/upload


json


{ "task": "Complete Module 1", "adminId": "674c323bc3582f9f6d7e2718" }


Admin Accept Assignment


Endpoint: POST /admin/assignments/:id/accept




Error Handling




  • 400 Bad Request: Missing or invalid input


  • 401 Unauthorized: Invalid or missing token


  • 404 Not Found: Resource not found


  • 500 Internal Server Error: Server-side errors




Tech Stack




  • Backend: Node.js, Express.js


  • Database: MongoDB, Mongoose


  • Authentication: JSON Web Tokens (JWT)




Development


Run Locally


Start the development server with:


bash


npm run start


Linting


Run ESLint to check for code quality:


bash


npm run lint