Babbelkes
A simple chat API built with Node.js, Express, and MongoDB.
Features
- Two CRUD entities: Users and Rooms
- Token-based authentication
- Pagination with limit/offset
- Search by field value
- Input validation
Installation
# Clone the repository
git clone https://github.com/nasrlol/babbelkes.git
cd babbelkes
# Install dependencies
npm install
# Start MongoDB (using Podman)
podman run -d --name mongodb -p 27017:27017 -v mongo_data:/data/db docker.io/library/mongo:7
# Start the server
npm start
The API runs on http://localhost:3000
API Documentation
Visit http://localhost:3000 for full API documentation.
Quick Start
# Create a user (returns token)
curl -X POST http://localhost:3000/api/users \
-H "Content-Type: application/json" \
-d '{"username": "john"}'
# Login (get token)
curl -X POST http://localhost:3000/api/users/login \
-H "Content-Type: application/json" \
-d '{"username": "john"}'
# Access protected routes
curl http://localhost:3000/api/rooms \
-H "Authorization: Bearer <your-token>"