Let's kick in create an HTTP endpoint that responds to GET requests with some static content, such as an HTML page or CSS stylesheet.
Steps
Use the node to listen for requests, anode to include the static content, and an node to reply to the request.
Example
We are going to use the below HTML code to show up on a page that we create using Interplay!
[~]$ curl http://localhost:1880/hello
<html>
<head></head>
<body>
<h1>Hello World!</h1>
</body>
</html>
Discussion
The
and pair of nodes are the starting point for all HTTP endpoints you create.
Any flow that starts with annode must have a path to annode otherwise requests will eventually timeout.
The node uses the payload
property of messages it receives as the body of the response. Other properties can be used to further customize the response – they are covered in other recipes.
The node provides a convenient way to embed a body of content into a flow. It may be desirable to maintain such static content outside of the flow.