A Java 8 REST proxy that acts as a proxy for a set of endpoints and can transform requests and responses.
- You have a legacy REST endpoint without proper authentication on your local network. You can configure and deploy this with some security enabled. Eg Spring Security or AWS Lambda api keys. See examples
- You need to integrate 2 (or more) RESTful services that have different apis. Sit this in the middle and configure the translations. This ought to be easier and faster than writing code.
- You want to simplify a REST api. No problem, use the built in functions or write your own to simplify it by merging attributes, etc.
- You want the headers to appear in the body, or an attribute in the body to appear as the status code.
- You want to augment certain attributes, eg you could write a function that queries from a database and updates a value
The proxy uses its own language and the parser is built in to keep the footprint low (but mainly as an interesting exercise for me!). If it is buggy or too limited, it may be replaced in future with a proper parser.
It is called compost because it is made up of composable functions and it uses postfix notation...only joking, its called compost for more obvious reasons :)
The typing is entirely dynamic, you need to make sure of the return value of a function before passing to another. Valid types are
- String => Surrounded by '' or without is if it is the only possibility
- Number => This are always interpreted as java doubles
- Boolean (true/false)
- List => List of one of the above
There are no Map types as such since map outputs in the body can be specified precisely in the configuration json. If this is something you need please open a PR!
- String functions
- Number functions
- Logical functions
- Path
- Headers
- Method
- Body
Eg functions on response values from proxied service. These can only be used in the response section of the config file (not strictly enforced yet, but be careful!)
- Body
- Headers
- Status Code
For the body functions, you can must use jsonPath.