]> code.delx.au - gnu-emacs-elpa/blob - packages/web-server/examples/004-url-param-echo.el
a3a7247a30b327fca85fe8fdba25a4e38e815c7c
[gnu-emacs-elpa] / packages / web-server / examples / 004-url-param-echo.el
1 ;;; url-param-echo.el --- echo back url-paramed message using Emacs Web Server
2 (ws-start
3 '(((:GET . ".*") .
4 (lambda (request)
5 (with-slots (process headers) request
6 (ws-response-header process 200 '("Content-type" . "text/html"))
7 (process-send-string process
8 (concat "URL Parameters:</br><table><tr>"
9 (mapconcat (lambda (pair)
10 (format "<th>%s</th><td>%s</td>"
11 (car pair) (cdr pair)))
12 (cl-remove-if-not (lambda (el) (stringp (car el)))
13 headers)
14 "</tr><tr>")
15 "</tr></table>"))))))
16 9004)