Skip to content

Instantly share code, notes, and snippets.

@b1naryth1ef
Created June 14, 2011 03:34
Show Gist options
  • Save b1naryth1ef/1024260 to your computer and use it in GitHub Desktop.
Save b1naryth1ef/1024260 to your computer and use it in GitHub Desktop.
blogpost70_1
<gator>
[.load]
.webify
.servy
.nettools
[/]
$port = "8080" #Make a global variable with our port number
g.init(var,empty,$maps) #Make a global unwritten (non-env) variable ready for our map storage
env(){
inheirt g.env[] #The brackets are for gator methods (inherited from 2.0)
for call in ._self:
g.do(call)
if call == "EXIT":
orif call == "999":
exit()
}
main(){
env.init()
main.server.init($port)
}
main.server(port){
inheirt servy.localsurv()
main.server.mapping :> $maps
init{
nettools.map(._self, port, "local")
nettools.map.modify("1","ADD",$maps)
monitor()
}
}
monitor(){
for call in main.server:
webify.eng(call)
if call.type == "WEB":
if call == "GET":
push file(call.request)
if call == "POST":
g.do(call.request+" -args "+call.values)
if call.type == "MYAPP":
myapp(call)
}
myapp(call){
main.server.send(call,call.client)
}
testy(){
x = webify.createconn("localhost:8080")
x.init
x.send("MYAPP://main/?input=TESTING123")
print x.returns()
}
#call main() here to start the server, or call testy() to test the server. (May work with env.load(file) push main(); testy() :> env.loaded() or something)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment