restQL-server is a server to run restQL queries, making easy to fetch information from multiple services in the most efficient manner. e.g:
from search
with
role = "hero"
from hero as heroList
with
name = search.results.name
Links
- restql.b2w.io: Project home page,
- game.b2w.io: A game developed to teach the basics of restQL language,
- restQL-core: If you want to embed restQL directly into your Clojure application,
- restQL-core-java: If you want to embed restQL directly into your Java application,
- restQL-manager: To manage saved queries and resources endpoints. restQL-manager requires a MongoDB instance.
- Tackling microservice query complexity: Project motivation and history
- Wiki: Project documentation.
Who're talking about restQL
- infoQ: restQL, a Microservices Query Language, Released on GitHub
- infoQ: 微服务查询语言restQL已在GitHub上发布
- OSDN Mag: マイクロサービスクエリ言語「restQL 2.3」公開
restQL Server allows you to post ad-hoc queries and to reference resources pre-configured in the server startup.
- Download the latest release in the release page,
- Unzip the package,
- Edit the file env.sh with the resources you want to invoke,
- Run bin/run.sh.
Post to http://your-server.ip:9000/run-query the body below and content-type text/plain:
curl -H "Content-Type: text/plain" localhost:9000/run-query -d "from planets as allPlanets"
- Learn restQL query language,
- Get involved :) We're looking for contributors, if you're interested ping ricardo.mayerhofer@b2wdigital.com
As prerequisites to build restQL-server from source we need:
- Java 8
- Leiningen
Build the server using the build script: scripts/build-dist.sh
.
The building script will create a folder dist
where you can configure your resources on the file dist/bin/env.sh
and run the server using the script dist/bin/run.sh
.
If you want to deploy restQL-server, copy the files under the generated dist
folder and start the server using the start script above.
restQL-server can also be run as a Docker container. First, from the root folder, build a Docker image with the command:
docker build -t restql-server-img .
Than run the image as a container with the command:
docker run -p 9000:9000 -e JAVA_OPTS="-Dmongo-url=mongodb://my-mongo-ip:27017/restql-server -Dplanets=http://swapi.co/api/planets/" restql-server-img
You can register your APIs as resources by passing them in JAVA_OPTS
environment variable, as seen above.
The server default port is 9000 but it can be changed by passing the PORT
environment variable with the desired port.
The MongoDB instance can also run from a container. If that's the case you can link to it and use its link name as the address:
docker run -p 27017-27017 --name mongo-docker mongo
docker run --link mongo-docker -p 9000:9000 -e JAVA_OPTS="-Dmongo-url=mongodb://mongo-docker:27017/restql-server -Dplanets=http://swapi.co/api/planets/" restql-server-img
The MongoDB dependency is optional and is used to run saved queries.
Copyright © 2016-2017 B2W Digital
Distributed under the MIT License.