Backend API for GetRides - A ride-sharing platform built with Node.js and Express.
GetRides Backend is a RESTful API server that powers the GetRides ride-sharing application. Built with Node.js and Express, it provides endpoints for user authentication, ride management, and real-time features.
Frontend Repository: GetRides-frontend
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB with Mongoose
- Authentication: JWT (JSON Web Tokens)
GetRides-backend/
├── configs/ # Configuration files
├── controllers/ # Request handlers
├── middlewares/ # Custom middleware
├── models/ # Database models
├── routes/ # API routes
├── .gitignore
├── package.json
├── package-lock.json
└── server.js # Entry point
- Node.js (v14 or higher)
- MongoDB
- npm or yarn
-
Clone the repository
git clone https://github.com/Prateet-Github/GetRides-backend.git cd GetRides-backend -
Install dependencies
npm install
-
Set up environment variables
Create a
.envfile in the root directory:PORT=5000 MONGODB_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key NODE_ENV=development
-
Start the server
Development mode:
npm run dev
Production mode:
npm start
The server will run on http://localhost:5000
POST /api/auth/register- Register new userPOST /api/auth/login- User loginGET /api/auth/profile- Get user profile
POST /api/rides- Create new rideGET /api/rides- Get all ridesGET /api/rides/:id- Get ride by IDPUT /api/rides/:id- Update rideDELETE /api/rides/:id- Delete ride
GET /api/users/:id- Get user detailsPUT /api/users/:id- Update user profile
The application uses MongoDB with Mongoose for data modeling:
- User Model - User account information
- Ride Model - Ride details and booking information
- Driver Model - Driver profiles and vehicle information
- JWT-based authentication
- Password hashing
- CORS enabled
- Environment variable protection
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
Prateet
- GitHub: @Prateet-Github