- π Overview
- β¨ Features
- π οΈ Tech Stack
- π Getting Started
- π Project Structure
- π API Endpoints
- π§ͺ Testing
- π Deployment
- π€ Contributing
- π License
Express Location is a full-stack web application built with the MEAN stack (MongoDB, Express.js, Angular, Node.js) that provides comprehensive location management functionality. This project demonstrates modern web development practices with a robust backend API and an interactive frontend interface.
This application serves as a complete solution for:
- Location data management
- Geographic information processing
- Real-time location tracking
- User-friendly location visualization
- Location Management: Create, read, update, and delete location data
- Geographic Search: Find locations by various criteria
- Real-time Updates: Live location tracking capabilities
- Interactive Maps: Visual representation of location data
- Data Validation: Robust input validation and error handling
- Authentication & Authorization: Secure user management
- Data Encryption: Protected sensitive information
- Optimized Queries: Efficient database operations
- Caching: Improved response times
- Error Handling: Comprehensive error management
- Framework:
- Styling: CSS3 with responsive design
- HTTP Client: Angular HttpClient for API communication
Before running this project, make sure you have the following installed:
- Node.js (v14.0.0 or higher)
- npm (v6.0.0 or higher)
- MongoDB (v4.0.0 or higher)
- Angular CLI (v12.0.0 or higher)
# Check your versions
node --version
npm --version
mongo --version
ng version- Clone the repository
git clone https://github.com/v9dev/epresslocation.git
cd epresslocation- Install backend dependencies
# Install server dependencies
npm install- Install frontend dependencies
# Navigate to client directory (if separate)
cd client
npm install
cd ..- Environment Variables
Create a
.envfile in the root directory:
# Server Configuration
PORT=3000
NODE_ENV=development
# Database Configuration
MONGODB_URI=mongodb://localhost:27017/expresslocation
DB_NAME=expresslocation
# JWT Configuration
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRE=7d
# API Keys (if using external services)
GOOGLE_MAPS_API_KEY=your_google_maps_api_key- Database Setup
# Start MongoDB service
sudo service mongod start
# Or using Docker
docker run -d -p 27017:27017 --name mongodb mongo:latest- Start the development server
# Start backend server
npm run dev
# Start frontend (in separate terminal)
cd client
ng serve- Access the application
- Frontend: http://localhost:4200
- Backend API: http://localhost:3000
- API Documentation: http://localhost:3000/api-docs
epresslocation/
βββ π config/ # Configuration files
β βββ database.js # Database configuration
β βββ auth.js # Authentication config
βββ π controllers/ # Route controllers
β βββ locationController.js # Location operations
β βββ authController.js # Authentication logic
βββ π models/ # Database models
β βββ Location.js # Location schema
β βββ User.js # User schema
βββ π routes/ # API routes
β βββ locations.js # Location routes
β βββ auth.js # Authentication routes
βββ π middleware/ # Custom middleware
β βββ auth.js # Authentication middleware
β βββ validation.js # Input validation
βββ π client/ # Angular frontend
β βββ π src/
β β βββ π app/
β β βββ π assets/
β β βββ π environments/
β βββ package.json
βββ π tests/ # Test files
βββ π docs/ # Documentation
βββ .env # Environment variables
βββ .gitignore # Git ignore file
βββ package.json # Node.js dependencies
βββ server.js # Main server file
βββ README.md # Project documentation
POST /api/auth/register # User registration
POST /api/auth/login # User login
GET /api/auth/profile # Get user profile
PUT /api/auth/profile # Update user profileGET /api/locations # Get all locations
GET /api/locations/:id # Get location by ID
POST /api/locations # Create new location
PUT /api/locations/:id # Update location
DELETE /api/locations/:id # Delete locationGET /api/locations/search?q=query # Search locations
GET /api/locations/nearby?lat=&lng= # Find nearby locations
GET /api/locations/filter?category= # Filter by category{
"success": true,
"data": {
"_id": "60d5ecb74b24a1b2c8d4e6f7",
"name": "Central Park",
"coordinates": {
"latitude": 40.785091,
"longitude": -73.968285
},
"category": "park",
"description": "A large public park in Manhattan",
"createdAt": "2024-06-17T10:30:00.000Z"
}
}# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Run specific test file
npm test -- --grep "location"tests/
βββ unit/ # Unit tests
β βββ controllers/ # Controller tests
β βββ models/ # Model tests
βββ integration/ # Integration tests
βββ e2e/ # End-to-end tests
# Build frontend for production
cd client
ng build --prod
# Start production server
npm run start:prod# Set environment variables for production
export NODE_ENV=production
export MONGODB_URI=your_production_db_uri
export JWT_SECRET=your_production_jwt_secret# Dockerfile example
FROM node:16-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 3000
CMD ["npm", "start"]We welcome contributions! Please follow these steps:
- Fork the repository
- Create a 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
- Follow the existing code style
- Write tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting
This project is licensed under the MIT License - see the LICENSE file for details.