blob: a517f4e7283b30e5e29624904818496d78d9bc29 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# 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
```bash
# 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
```bash
# 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>"
```
## Sources
- [Express.js Documentation](https://expressjs.com/)
- [Mongoose Documentation](https://mongoosejs.com/docs/)
- [MongoDB Documentation](https://www.mongodb.com/docs/)
|