DevConnect is a Node.js-based backend API application designed for user authentication, request handling, profile management, and user data operations. Built using Express, MongoDB, and modern middleware like cookie-parser and cors.
- User Authentication (Login, Register, etc.)
- Request Submission & Handling
- User Profile Management
- Token-based Auth with Cookies
- CORS Configured for Frontend (e.g. React)
- Node.js with Express
- MongoDB with Mongoose
- cookie-parser
- dotenv
- cors
Before starting, ensure you have the following installed:
- Clone the repository
git clone https://github.com/your-username/DevConnect.git
cd DevConnect- Install dependencies
npm install- Setup environment variables
Create a .env file in the root directory and add:
MONGO_URI=your_mongo_connection_string
JWT_SECRET=your_secret_keynode app.jsServer runs on: http://localhost:7777
curl --location 'http://localhost:7777/signup' \
--header 'Content-Type: application/json' \
--data-raw '{
"firstName": "YourFirstName",
"lastName": "YourLastName",
"emailId": "your@example.com",
"password": "yourpassword",
"age": "30",
"gender": "yourgender",
"about": "short bio"
}'curl --location 'http://localhost:7777/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"emailId": "your@example.com",
"password": "yourpassword"
}'curl --location 'http://localhost:7777/logout' \
--header 'Content-Type: application/json' \
--header 'Cookie: token=<your_token>' \
--data-raw '{}'curl --location 'http://localhost:7777/request/send/interested/<targetUserId>' \
--header 'Content-Type: application/json' \
--header 'Cookie: token=<your_token>' \
--data-raw '{}'curl --location 'http://localhost:7777/request/review/rejected/<requestId>' \
--header 'Content-Type: application/json' \
--header 'Cookie: token=<your_token>' \
--data-raw '{}'curl --location 'http://localhost:7777/user/requests/received' \
--header 'Cookie: token=<your_token>' \
--data ''curl --location 'http://localhost:7777/user/connections' \
--header 'Cookie: token=<your_token>' \
--data ''curl --location 'http://localhost:7777/feed' \
--header 'Cookie: token=<your_token>'curl --location 'http://localhost:7777/profile/view' \
--header 'Cookie: token=<your_token>'curl --location --request PATCH 'http://localhost:7777/profile/edit' \
--header 'Content-Type: application/json' \
--header 'Cookie: token=<your_token>' \
--data '{
"firstName": "NewName"
}'- Replace
<your_token>with a valid JWT token after login. - Replace placeholders like
<targetUserId>and<requestId>with actual IDs from your database. - Use tools like Postman or the provided
curlfor testing.
This app is preconfigured to accept frontend requests from:
http://localhost:5173
To change this, update the cors() settings in app.js.
You can optionally set up ESLint + Prettier for maintaining code style.
- Never push
.envto version control - Use HTTPS in production
- Set secure cookie flags in production