https://github.com/leytox/cs-api
CS 1.6 API. Data in handy JSON about Weapons, Equipment, Maps etc.
https://github.com/leytox/cs-api
api counter-strike express expressjs mongodb mongoose nodejs swagger
Last synced: 2 months ago
JSON representation
CS 1.6 API. Data in handy JSON about Weapons, Equipment, Maps etc.
- Host: GitHub
- URL: https://github.com/leytox/cs-api
- Owner: Leytox
- License: unlicense
- Created: 2024-10-06T17:23:33.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-12-30T13:07:38.000Z (7 months ago)
- Last Synced: 2025-03-30T21:51:12.133Z (4 months ago)
- Topics: api, counter-strike, express, expressjs, mongodb, mongoose, nodejs, swagger
- Language: JavaScript
- Homepage: https://cs-api.up.railway.app
- Size: 4.81 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Counter-Strike 1.6 API 🎮

A comprehensive RESTful API providing detailed information about Counter-Strike 1.6, including weapons, maps, equipment, and character classes.

## 📋 Table of Contents
- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Running the Application](#running-the-application)
- [API Documentation](#api-documentation)
- [Docker Support](#docker-support)
- [Contributing](#contributing)
- [License](#license)## ✨ Features
- **Comprehensive Data**: Detailed information about weapons, maps, equipment, and character classes
- **RESTful Architecture**: Clean and intuitive API endpoints
- **Documentation**: Interactive Swagger documentation
- **Docker Support**: Easy deployment with Docker
- **Rate Limiting**: Protected against abuse
- **Input Validation**: Secure request validation
- **CORS Support**: Cross-Origin Resource Sharing enabled
- **Pagination**: Efficient data retrieval
- **Error Handling**: Consistent error responses## 🔧 Requirements
- Node.js >= 16.0.0
- MongoDB >= 4.4
- Docker (optional)## 🚀 Installation
### Local Setup
1. Clone the repository:
```bash
git clone https://github.com/Leytox/cs-api.git
cd cs-api
```2. Install dependencies:
```bash
npm install
```3. Create a `.env` file:
```env
PORT=5000
MONGODB=mongodb://localhost:27017/cs-api
ENVIRONMENT=development
```### 🐳 Docker Setup
1. Using Docker Compose:
```bash
# Development
npm run docker:dev:up# Production
npm run docker:up
```## 🏃♂️ Running the Application
### Development Mode
```bash
npm run dev
```### Production Mode
```bash
npm start
```## 📚 API Documentation
### Base URL
```
http://localhost:5000/api/v1
```### Authentication
Currently, the API is publicly accessible and doesn't require authentication.### Endpoints
#### Weapons API
```http
GET /weapons
GET /weapons/{id}
GET /weapons/name/{name}
GET /weapons/type/{type}
GET /weapons/country/{country}
```**Example Response:**
```json
{
"name": "AK-47",
"type": "Rifle",
"price": 2500,
"countryOfOrigin": "Soviet Union",
"faction": ["Terrorist"],
"caliber": "7.62mm",
"clipCapacity": 30,
"rateOfFire": 600,
"weight": 4.79,
"muzzleVelocity": 715,
"muzzleEnergy": 2108,
"image": "/images/weapons/ak47.png"
}
```#### Maps API
```http
GET /maps
GET /maps/{id}
GET /maps/name/{name}
GET /maps/scenario/{scenario}
GET /maps/developer/{developer}
```**Example Response:**
```json
{
"name": "de_dust2",
"scenario": "Bomb/Defuse",
"developers": ["David Johnston"],
"background": "Middle Eastern",
"counterTerroristsMission": "Prevent Terrorists from bombing",
"terroristsMission": "Plant the bomb and defend until detonation"
}
```#### Equipment API
```http
GET /equipment
GET /equipment/{id}
GET /equipment/name/{name}
GET /equipment/faction/{faction}
```#### Classes API
```http
GET /classes
GET /classes/{id}
GET /classes/name/{name}
GET /classes/faction/{faction}
```### Query Parameters
#### Pagination
```
?limit=10 // Number of items per page (default: 10, max: 100)
?offset=0 // Number of items to skip (default: 0)
```### Status Codes
```
200 - Success
400 - Bad Request
404 - Not Found
429 - Too Many Requests
500 - Internal Server Error
```### Error Response Format
```json
{
"error": "Error Type",
"message": "Detailed error message",
"details": []
}
```## 🐳 Docker Support
### Development Environment
```bash
npm run docker:dev:build
npm run docker:dev:up
npm run docker:dev:down
```### Production Environment
```bash
npm run docker:build
npm run docker:up
npm run docker:down
```### Environment Variables
- `PORT`: API port (default: 5000)
- `MONGODB`: MongoDB connection string
- `ENVIRONMENT`: Application environment (development/production)## 🤝 Contributing
1. Fork the repository
2. Create your feature branch
```bash
git checkout -b feature/my-feature
```
3. Commit your changes
```bash
git commit -m "Add some feature"
```
4. Push to the branch
```bash
git push origin feature/my-feature
```
5. Open a Pull Request### Contribution Guidelines
- Follow the existing code style
- Write meaningful commit messages
- Update documentation as needed
- Add tests for new features
- Ensure all tests pass before submitting PR## 📝 License
This project is unlicensed## 👥 Authors
- Ilya "Leytox" Devder - [GitHub](https://github.com/Leytox)## 🙏 Acknowledgments
- Counter-Strike community
- Valve Corporation