MiniM Overview |
MiniM
Knowledge Base | Jun 11, 2010 How to use MiniM as a CGI module The process of MiniM Database Server can be run with using of standard input / output, and this possibility allow to run one instead of simple CGI handler of WEB requests. To run MiniM process as a CGI handler requires to execute the following steps: 1. Take an Apache. (Apache Web Server) 2. To the cgi-bin directory of Apache write file hello.m with the following content: #! e:\workfiles\minim\bin\minim -std -h -x "zn \"user\" d ^WEB" -ignore 3. Create routine ^WEB with the following content: WEB w "Content-Type: text/html",$c(10,10) w "<html>",$c(10) w "<head><title>Web Response from MiniM</title></head>",$c(10) w "<body>",$c(10) w "<h3>Web Response from MiniM</h3>",$c(10) w "<p>",$zv,$c(10) w "<p>",$v("proc",9,"SERVER_SOFTWARE"),$c(10) w "<p>Query parameters are:",$c(10) w "<p>",$v("proc",9,"QUERY_STRING"),$c(10) w "</body>",$c(10) w "</html>",$c(10) q 4. Point Web browser to http://localhost/cgi-bin/hello.m 5. Point Web browser with parameters: http://localhost/cgi-bin/hello.m?param=123 And now short explanation about this steps: 1) Instead of expected w "Content-Type: text/html",!!we wrote w "Content-Type: text/html",$c(10,10)becouse the Apache waits exactly these bytes as string terminators in HTTP header. 2) e:\workfiles\minim\bin\minim points to run MiniM process. Of course, here need to be specified real executable location. 3) -std points to process use standard input / output 4) -h points to process to halt after last command executed 5) -x points to process execute the following parameter 6) \"user\" points to transfer double quotes inside of parameter 7) d ^WEB points to execute routine ^WEB 8) Instead of line ends ! used directly specified symbol $c(10). All places otherwise then http headers can use "write !" too. 9) $v("proc",9,paramname) get process environment parameters, which creates web server while run MiniM process a sa cgi handler. 10) To transform text and values to HTML representation can be used function $zcvt(). 11) Parameter -ignore points to process ignore other parameters which appends by web server automatically. This cgi method on the one hand, short and allow precisely create all web response, and with the other CGI does not limited by process, so web requests can owerflow MiniM Database Server limits. For this case can be recommended to use MiniM Web Access. Eugene Karataevsupport@minimdb.com
|
|
Info Support |