Quick Start
Download the
httpstub
JAR file from the Github repository's releases page. Or download docker image fromghcr.io
Create folder for stubs
Create a YAML file
api-definition.yaml
atdata
folder with the API definition.
Here's an example YAML file that defines a simple endpoint that returns a static JSON response:
This YAML file specifies that when an HTTP GET request is received with a path of /hello
, the server should respond with a 200 status code and a plain text containing the message "Hello, world!".
Run the
httpstub
server using the following command(replacinghttpstub.jar
with the name of the JAR file you downloaded in step 1):
This will start the httpstub
server and load the API definition from the YAML file from $(pwd)/data
(folder with data from our current location).
Test the
httpstub
server by sending an HTTP GET request to the endpoint defined in the YAML file. For example, if you're running the server onlocalhost
port8080
, you can use a tool likecurl
to send the request:
This should return the following response:
That's it! You've successfully set up and tested an httpstub
server using a YAML API definition file.
Docker
Docker image is available on ghcr.io/gleb619/httpstub
Last updated