A Social Networking API for connecting developers. Find your perfect coding partner!
- Introduction
- Features
- Authentication
- API Endpoints
- Error Handling
- Data Models
- Getting Started
- Contributing
- License
- Contact
This API allows developers to connect with each other, send connection requests, and manage their profiles. Think of it as a "Tinder for Developers," facilitating networking and collaboration opportunities.
- User Management: Create, update, and retrieve developer profiles.
- Connection Requests: Send, accept, and reject connection requests.
- Authentication: Secure API using JWT (JSON Web Tokens).
- Profile Matching: (Future Enhancement) Suggest potential connections based on skills and interests.
- Real-time Chat: (Future Enhancement) Enable real-time communication between connected developers.
This API uses JSON Web Tokens (JWT) for authentication. Upon successful login, a token is issued which must be included in subsequent API requests in the Authorization header using the Bearer scheme.
Example:
Authorization: Bearer <your_jwt_token>
Tokens expire after 1 hour, requiring users to re-authenticate.
- POST /auth/signup - Register a new user
- POST /auth/login - Authenticate and receive a JWT token
- POST /auth/logout - Invalidate the current JWT token
- GET /profile/view - View your profile
- PATCH /profile/edit - Update your profile information
- PATCH /profile/password - Update your password
- POST /request/send/interested/:userId - Send an interested request to a user
- POST /request/send/ignore/:userId - Ignore a user
- POST /request/review/accepted/:requestId - Accept a connection request
- POST /request/review/rejected/:requestId - Reject a connection request
- GET /user/connections - Get all your connections
- GET /user/requests/received - Get all connection requests received
- GET /user/feed - Get profiles of other users on the platform
The API uses conventional HTTP response codes to indicate the success or failure of requests:
- 2xx - Success
- 4xx - Client errors (invalid request, unauthorized)
- 5xx - Server errors
Each error response includes:
- status - HTTP status code
- message - Human-readable error description
- error - Error details when applicable
Example error response:
{
"status": 400,
"message": "Invalid request parameters",
"error": "First name is required"
}{
firstName: String, // Required, 4-50 chars
lastName: String, // Optional, max 30 chars
emailId: String, // Required, unique, valid email
password: String, // Required, strong password
age: Number, // Required, min 18
gender: String, // Required, enum: ["male", "female", "other"]
photoUrl: String, // Default profile picture URL
about: String, // Optional, max 500 chars
skills: [String] // Optional, max 15 skills
}{
fromUserId: ObjectId, // Required, reference to User
toUserId: ObjectId, // Required, reference to User
status: String // Required, enum: ["rejected", "accepted", "ignore", "interested"]
}- Node.js (version 14.x or higher)
- npm (version 6.x or higher) or yarn
- MongoDB (version 4.x or higher)
-
Clone the repository:
git clone https://github.com/yourusername/date-developer.git cd date-developer -
Install dependencies:
npm install
-
Create a
.envfile in the root directory based onexample.env:cp example.env .env
-
Update the environment variables in the
.envfile:MONGODB_URL=mongodb://localhost:27017/date-developer JWT_SECRET=your_jwt_secret_here
-
Start the development server:
npm run dev
-
The API will be available at
http://localhost:4000
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the ISC License - see the LICENSE file for details.
For questions or support, please contact Aashish Panthee.