xnhttpd
v0.8.0
xnhttpd {OPTIONS} [SETTING-JSON-PATH]
ซึ่งเริ่มให้บริการบน LocalHost: 8000 และเรียกสคริปต์ CGI บนไดเรกทอรีปัจจุบัน
JSON สำหรับการตั้งค่าเป็นเหมือนด้านล่าง
{
"handler" :{
".pl" : " c:/Program Files/Git/usr/bin/perl.exe "
},
"markdown" :{
"html" : true ,
"hardwrap" : true
}
} หากต้องการใช้ตัวอย่าง Wiki-Engine ให้เปิด http://127.0.0.1:8000/wiki.pl พร้อมเว็บเบราว์เซอร์
เมื่อคำต่อท้ายของ URL ที่ร้องขอจะลงท้ายด้วย .md และไฟล์มีอยู่จะมีการแสดง markdown แบบฝังตัว (Goldmark)
ถ้า { "markdown":{ "html":true }} ถูกกำหนดไว้จะมีการกำหนด Raw-html-tags ใน *.md
เมื่อคำต่อท้ายของ URL ที่ร้องขอจะจบลงด้วย .lua และไฟล์มีอยู่แล้ว Lua-Interpretor ที่ฝังตัว (Gopherlua) จะทำงาน
print ( " <html><body> " )
print ( " <h1>Embedded Lua Test</h1> " )
for _ , key in pairs {
" QUERY_STRING " ,
" CONTENT_LENGTH " ,
" REQUEST_METHOD " ,
" HTTP_COOKIE " ,
" HTTP_USER_AGENT " ,
" SCRIPT_NAME " ,
" REMOTE_ADDR " ,
} do
print ( string.format ( " <div>%s=%s</div> " , esc ( key ), esc ( _G [ key ])))
end
print ( " <hr /> " )
print ( string.format ( " <div>a=%s</div> " , esc ( get ( " a " ))))
print ( string.format ( [[
<form action="%s" method="post">
<div>New `a` value</div>
<div>
<input type="text" name="a" value="%s" />
<input type="submit" />
</div>
</form>
]] , esc ( SCRIPT_NAME ), esc ( get ( " a " ))))
local counter = cookie ( " counter " )
if counter and counter . value then
counter = { value = tonumber ( counter . value ) + 1 }
else
counter = { value = 1 }
end
setcookie ( " counter " , counter . value )
print ( " counter= " .. counter . value )
print ( " </body></html> " )ดาวน์โหลดแพ็คเกจไบนารีจากรีลีสและแยกการปฏิบัติการ
go install github.com/hymkor/xnhttpd
scoop install https://raw.githubusercontent.com/hymkor/xnhttpd/master/xnhttpd.json
หรือ
scoop bucket add hymkor https://github.com/hymkor/scoop-bucket
scoop install xnhttpd