Lyre is a project designated to help developers as a REST services mock API. Our name references the lyrebird species, which can mimic natural and artificial sounds from their environment. Analogously, Lyre application provides multiples ways to create, edit and expose endpoints (mimic them) for development/test purpose.
View complete docs on our wiki.
- Java 8 or superior.
You can download on github or build by yourself.
- Download Lyre at: available releases
or - Getting source code
$ git clone https://github.com/groovylabs/lyre.git $ cd lyre
-
Build and use as dependency:
$ ./mvnw clean install
with maven:
<dependency> <groupId>com.github.groovylabs</groupId> <artifactId>lyre</artifactId> <version>1.0.0-RC</version> </dependency>
with gradle:
compile group: 'com.github.groovylabs', name: 'lyre', version: '1.0.0-RC'
-
Add @EnableLyre
annotation on your Spring Boot application to start it.
@EnableLyre
@SpringBootApplication
public class YourApp {
public static void main(String[] args) {
SpringApplication.run(YourApp.class);
}
}
Run command below to run Lyre:
docker run -p <your-port>:8080 -v <your-path>:/lyre/shared -it groovylabs/lyre
If you want more information about running Lyre with Docker, please check our wiki.
To run application with default configurations, run:
java -jar -Dlyre.scan-path=<your-path> lyre-<lyre-version>-standalone.jar
If you want more information about running Lyre with JAR, please check our wiki.
Instead of your-path put the directory path you want to share (containing endpoint files or/and properties).
First create a file with .lyre
suffix.
NOTE: It is possible to change which file format lyre will scan by setting lyre.file-format
property.
Lyre supports two data formats: YAML and JSON, you can choose whatever you prefer or combine them across files.
/dir
- yaml_endpoints.lyre
- json_endpoints.lyre
Do not forget to set lyre.scan-path
property to endpoint's directory.
Hello world!
YAML:
GET /hello:
response:
data: Hello World!
status: 200
JSON:
{
"GET /hello" : {
"response" : {
"data" : "Hello World!",
"status" : "200"
}
}
}
Check our lyre syntax to learn more about supported properties. Also check our examples.
Use our preffix: lyre.
Name | Property | Default value |
---|---|---|
Enable remote connections | enable-remote-connection | false |
Enable live reload | enable-live-reload | false |
Lyre application port | port | 8234 |
Path to scan files | scan-path | $USER.DIR |
File suffix extension | file-format | .lyre |
Servlet context path | context-path | none |
Lyre Application path | application-path | api |
$ export LYRE_PORT=8080
$ export LYRE_ENABLE_REMOTE_CONNECTIONS=true
$ echo 'lyre.port=8080' >> application.properties
$ echo 'lyre.enable_remote_connection=true' >> application.properties
@EnableLyre(port = 8080, enableRemoteConnections = "true")
We welcome contributions of all kinds from anyone. Please take a moment to review the guidelines for contributing.
Copyright (c) 2017 Groovylabs and other contributors
Licensed under the MIT License