Last active
February 11, 2017 21:30
-
-
Save rgchris/c3fa52d8a68c8021c1b0c53a720bae44 to your computer and use it in GitHub Desktop.
Get Object
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/rebol -cs | |
Rebol [ | |
Title: "Get Object" | |
Author: "Christopher Ross-Gill" | |
] | |
do %httpd.r | |
do %altjson.r | |
bulbs: [ | |
[one][two][three][four] | |
] | |
open/custom httpd://:8080 [ | |
path: parse/all next any [request/target "/"] "/" | |
response/type: "application/json" | |
response/content: to-json switch/default take path [ | |
"lights" [ | |
switch/default take path [ | |
"3" [bulbs/3] | |
"4" [bulbs/4] | |
#[none] [bulbs] | |
][ | |
["Not Found"] | |
] | |
] | |
][ | |
["Not Found"] | |
] | |
] | |
browse http://127.0.0.1:8080/lights/4 | |
wait [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment