On this page
Get Started
Download and run
Just download a pre-compiled version for your OS.
Run the other examples with curl
or Invoke-WebRequest
.
$ curl http://localhost:3000/date
Sun Feb 25 11:42:13 CET 2024
$ curl http://localhost:3000/hello-world
Hello World
$ curl http://localhost:3000/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
Finally, point a browser to the URL http://localhost:3000/button
. You will get a button called “Date”.
Click on it. After the request has been executed, inside the green confirmation box, click on “Click to inspect” to see
how HTTPE has executed a script and send back the output.
Understand the rules
Let’s look at the rule file.
|
|
- All rules must be child items of the
rules
object. (Line 3) - Rules must be defined as a list, hence each rule must start with a dash. (Line 4)
- A rule must have a name for identification. (Line 4)
- The
on
object defines the request matcher. In the shown example the rule takes action if the request goes to thehello
path. Because themethod
is not defined, this rules takes action on all request methods. (Lines 5-6) - With the
run.script
object (Line 7) you define an action to execute if theon
definition matches the request. The script specified will be executed by the default shell. Stdout is returned as http response. (Lines 8-10) {{ .Input.Params.Name }}
is a template macro. HTTPE will replace it by the URL parameterName
before execution. (Line 9)