Quick Start
此内容尚不支持你的语言。
This guide will help you start MiniGateway and make your first API proxy request.
Starting the Server
Section titled “Starting the Server”# Install MiniGatewaynpm install -g @minigateway/cli
# Start the serverminigateway start
# Or with custom optionsminigateway start --port 8080 --log-level debugThe server will start and display:
╔════════════════════════════════════════════════════════════╗║ MiniGateway ║╠════════════════════════════════════════════════════════════╣║ Server: http://localhost:8080 ║║ ║║ Endpoints: ║║ - Web UI: http://localhost:8080/ui ║║ - Admin API: http://localhost:8080/admin ║║ - Proxy: http://localhost:8080/ (via routes) ║╚════════════════════════════════════════════════════════════╝Initialize Configuration
Section titled “Initialize Configuration”Create a configuration template:
# Create default config fileminigateway init
# View the generated configcat ~/Library/Application\ Support/minigateway/config.yaml # macOScat ~/.config/minigateway/config.yaml # LinuxCreate Your First Service
Section titled “Create Your First Service”Use the Admin API or CLI to create a service:
# Via CLIminigateway admin services create --name "my-api" --url "https://httpbin.org"
# Via Admin APIcurl -X POST http://localhost:8080/admin/services \ -H "Content-Type: application/json" \ -d '{"name": "my-api", "url": "https://httpbin.org"}'Create a Route
Section titled “Create a Route”# Via CLIminigateway admin routes create \ --service-id "<service-id>" \ --path "/api/*" \ --methods "GET,POST"
# Via Admin APIcurl -X POST http://localhost:8080/admin/routes \ -H "Content-Type: application/json" \ -d '{"service_id": "<service-id>", "path": "/api/*", "methods": ["GET", "POST"]}'Test the Proxy
Section titled “Test the Proxy”# Request through the proxycurl http://localhost:8080/api/getCommon CLI Options
Section titled “Common CLI Options”| Option | Description | Default |
|---|---|---|
--port | Server port | 8080 |
--db | Database file path | Platform-specific |
--log-level | Log verbosity (debug, info, warn, error) | info |
--no-ui | Disable Web UI | false |
--ui-dist | Custom UI dist path | auto-detected |
Environment Variables
Section titled “Environment Variables”| Variable | Description |
|---|---|
MINIGATEWAY_LOG_LEVEL | Default log level |
MINIGATEWAY_UI_DIST | Web UI dist path |
Next Steps
Section titled “Next Steps”- Configuration Guide - Detailed configuration options
- Core Concepts - Understand the architecture
- Plugins - Add authentication and rate limiting