English | 简体中文
- Build Requirements: Golang 1.11+
- Melody Version: 1.0.8
Melody is a high-performance open source API gateway to help you to sort out your complex api.
If you are building for the web, mobile, or IoT (Internet of Things) you will likely end up needing common functionality to run your actual software. Melody can help by acting as a gateway for microservices requests while providing load balancing, logging, authentication, rate-limiting, transformations, and more through middlewares.
Documentation | Installation | Site | Configer | Test API
- Melody Document Repository: A Document Repository for Melody.
- Melody Document:Detailed documentation for Melody.
- Melody Data Monitor:Data monitoring system built using Vue.
- Melody Config Respository:A respository for online visual configuration system.
- Melody Online Config:Online visual configuration system for Molody.
- Melody SIte Respository:Melody Web Site Respository.
- Melody Site:Melody Web Site.
- Test API Repository:Using this to quick satrt your golang web application.
Linux or Mac :
make build
Windows :
go build .
melody [command]
command | description |
---|---|
check | Check that the config |
run | Run the Melody server |
help | Help about any command |
graph | generate graph of melody server |
flag-abbr | flag-full | description |
---|---|---|
-c | -config | Path of the melody.json |
-d | -debug | Enable the Melody debug |
-h | -help | Help for melody |
Clone our project
$ git clone https://github.com/flipped-aurora/melody.git
$ cd melody
$ go build .
Create a file called melody. Json
{
"version": 1,
"extra_config": {
"melody_gologging": {
"level": "DEBUG",
"prefix": "[Grant]",
"syslog": false,
"stdout": true,
"format": "default"
}
},
"timeout": "3000ms",
"cache_ttl": "300s",
"output_encoding": "json",
"port": 8000,
"endpoints": [{
"endpoint": "/findone/{name}",
"method": "GET",
"extra_config": {
"melody_proxy": {
"sequential": true
}
},
"output_encoding": "json",
"concurrent_calls": 1,
"backends": [{
"url_pattern": "/user/{name}",
"group": "base_info",
"encoding": "json",
"extra_config": {},
"method": "GET",
"host": [
"127.0.0.1:9001"
]
},
{
"url_pattern": "/role/{resp0_base_info.role_id}",
"encoding": "json",
"extra_config": {},
"method": "GET",
"group": "role_info",
"host": [
"127.0.0.1:9001"
]
}
]
},
{
"endpoint": "/ping",
"backends": [{
"url_pattern": "/__debug/bar",
"host": [
"127.0.0.1:8000"
]
}]
}
]
}
Check that the config
melody check -c melody.json
Use command to run Melody
melody run -c melody.json
- CLI: Control your Melody API Gateway from the command line.
- REST API: Melody can be operated with its RESTful API for maximum flexibility.
- Transformations: Add, remove, or manipulate HTTP requests and responses.
- Rate-limiting: Block and throttle requests based on many variables.
- Authentications: Melody supports JWT and JWK.
- Monitoring: Live monitoring provides key load and performance server metrics.
- Service Discovery: Melody integrates etcd to support service discovery.
- Logging: Log requests and responses to your system.
- Syslog: Logging to System log.
- Security: Bot Monitor, whitelist/blacklist,SSL, etc...
- Circuit-Breaker: Intelligent tracking of unhealthy upstream services.
- Forward Proxy: Make Melody connect to intermediary transparent HTTP proxies.
- metrics:Monitor and statistic system operation data.
- influxdb: Melody integrates with influxDB, writing the data gathered by Metrics to influxDB.
- CORS:Support for cross-domain processing.
For more info about middlewares and integrations, you can visit Documentation