newLips http server, access from within newLisp

Started by protozen, February 18, 2015, 11:48:43 AM

Previous topic - Next topic

protozen

Are there any plans to offer an api to access the development server, with an api from newLisp instead of the command line? I'm looking at creating a few small packaged servers that I would like to have configured and executed from newLips. Having some soft of API for the built in HTTP processor would be nice. Has anyone done this before?

Lutz

#1
you can start one or more new instances from a newLISP script:



newLISP v.10.6.2 64-bit on OSX IPv4/6 UTF-8 libffi, options: newlisp -h

> (process "/usr/bin/newlisp -http -d12345 -w/Users/lutz/test/")
9965
> (get-url "http://localhost:12345")
"<html>n<head>n<title>Index</title>n<h1>Hello World</h1>n</body>n</html>n"
>


the index.html is in the /Users/lutz/test/ working directory. Instead of port 12345 choose 80 for the HTTP default port, but you would need administrator permissions for ports < 1024 on Unix like platforms.



PS: see also the map-reduce example for net-eval servers instead of http servers:

http://www.newlisp.org/syntax.cgi?code/mapreduce.txt">http://www.newlisp.org/syntax.cgi?code/mapreduce.txt

protozen

#2
Thanks Lutz. I was asking because I was hoping I could source link -x into a simple single executable .

protozen

#3
I think I misunderstood in how net-eval can be used, as in the map reduce examples. It's not what I had in mind, but I think I get can what I wanted using this.