-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Graham Chiu edited this page Feb 20, 2020
·
2 revisions
Rebol [
title: "Demo Usage"
Notes: {
check the request/action. If it matches a request of the web root, then deliver the index.html
If you want to add cookies etc, then you'll have to currently modify the build-header function
in the httpd.
Currently you can use `render` to send text to the client. This sets the http code to 200.
But it would be good if we had options to also set header values
eg. set-cookie, and CORS.
}
]
import <httpd>
srv: open [
scheme: 'httpd 8888
[
probe request/action
if request/action = "GET /" [
response/content: to text! lib/read %index.html
response/length: length-of response/content
]
probe response
]
]
wait [srv]
or more simply
srv: open [
scheme: 'httpd 8888
[
probe request/action
if request/action = "GET /" [
render to text! lib/read %index.html
]
probe response
]
]