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.
- Host: GitHub
- URL: https://github.com/pintu544/assignment-submission-portal
- Owner: pintu544
- Created: 2024-12-01T11:34:15.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-12-01T11:46:25.000Z (6 months ago)
- Last Synced: 2025-02-10T09:33:16.380Z (4 months ago)
- Topics: expressjs, mongodb, nodejs, typescript
- Language: TypeScript
- Homepage: https://assignment-submission-portal-a385.onrender.com
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.MD
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
Clone the repository:
git clone https://github.com/pintu544/assignment-submission-portal
cd assignment-submission-portal`Install dependencies:
bash
npm install
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
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