Last active
February 7, 2018 15:29
-
-
Save rgchris/e0d490c09852c169ce8d42d5eb89ab20 to your computer and use it in GitHub Desktop.
HTTPd Example for Ren-C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/ren-c | |
Rebol [ | |
Title: "HTTPd Example" | |
Date: 7-Feb-2018 | |
Author: "Christopher Ross-Gill" | |
File: %httpd-example.reb | |
Rights: http://opensource.org/licenses/Apache-2.0 | |
Needs: [<httpd>] | |
] | |
also: lib/also: func [value1 value2][value1] | |
server: open [ | |
scheme: 'httpd 8080 [ | |
if switch request/action [ | |
"GET /" [ | |
response/content: { | |
<!DOCTYPE html> | |
<html> | |
... html page ... | |
</html> | |
} | |
] | |
"GET /favicon.ico" [ | |
response/type: "image/png" | |
response/content: #{} ; read http://rebol.info/assets/rebolbot.png | |
] | |
"GET /build.js" [ | |
response/type: "text/javascript" | |
response/content: #{} ; contents of the build | |
] | |
][ | |
response/status: 200 | |
] | |
] | |
] | |
browse http://localhost:8080/ | |
wait server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment