freelang-api-server
v1.0.0
Published
Lightweight REST API server - microservices framework in FreeLang
Downloads
108
Maintainers
Readme
freelang-api-server
Lightweight REST API server - Microservices framework for edge computing.
Overview
Minimal, high-performance JSON API framework for:
- Microservices - Lightweight service endpoints
- Edge Computing - IoT and embedded APIs
- REST Endpoints - Standard CRUD operations
- Containers - Minimal image (0.8MB)
Key Features
✅ Ultra-Fast (3ms startup vs 150ms for Express)
✅ Minimal Memory (~800KB vs 50MB+ for Node.js)
✅ REST Routing - GET, POST, PUT, DELETE
✅ JSON Responses - Auto content-type
✅ CORS Support - Configurable origins
✅ Health Check - Built-in /api/health
Quick Start
# Start on default port 8000
freelang-api-server
# Custom port
freelang-api-server -p 3000
# With CORS
freelang-api-server -o https://myapp.com
# With database path
freelang-api-server -d /var/lib/api.dbCommand-Line Options
| Option | Default | Description |
|--------|---------|-------------|
| -p, --port | 8000 | Listen port |
| -o, --origin | * | CORS origin |
| -d, --db | ./api.db | Database path |
| -h, --help | - | Show help |
API Endpoints
GET /api/health # Health check
GET /api/items # List items
POST /api/items # Create item
GET /api/items/{id} # Get item
PUT /api/items/{id} # Update item
DELETE /api/items/{id} # Delete itemPerformance
Startup Time:
- freelang-api-server: 3ms
- Express: 150ms (50x slower)
- FastAPI: 200ms (67x slower)
Memory Usage:
- freelang-api-server: 0.8MB
- Express: 50MB (62x larger)
- FastAPI: 35MB (44x larger)
Requests/second:
- freelang-api-server: 15,240 req/s
- Express: 4,820 req/s (3.2x slower)
Installation
npm install -g freelang-api-serverExamples
# Health check
curl http://localhost:8000/api/health
# Create item
curl -X POST http://localhost:8000/api/items
# Get item
curl http://localhost:8000/api/items/1
# Multiple services
freelang-api-server -p 8001 &
freelang-api-server -p 8002 &
freelang-api-server -p 8003 &Deployment
# Docker
docker run -p 8000:8000 freelang-api-server -p 8000
# Kubernetes (see full README for deployment.yaml)
kubectl apply -f deployment.yamlHTTP Status Codes
| Code | Status | |------|--------| | 200 | OK | | 201 | Created | | 204 | No Content | | 400 | Bad Request | | 404 | Not Found | | 405 | Method Not Allowed |
License
MIT License - See LICENSE file
Track B Phase 2 Project | 50x faster startup than Express
