]> code.delx.au - gnu-emacs-elpa/blob - packages/web-server/examples/004-url-param-echo.el
Merge commit '0cda39255827f283e7578cd469ae42daad9556a2' from js2-mode
[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 ;; Copyright (C) 2014 Free Software Foundation, Inc.
3
4 (ws-start
5 '(((:GET . ".*") .
6 (lambda (request)
7 (with-slots (process headers) request
8 (ws-response-header process 200 '("Content-type" . "text/html"))
9 (process-send-string process
10 (concat "URL Parameters:</br><table><tr>"
11 (mapconcat (lambda (pair)
12 (format "<th>%s</th><td>%s</td>"
13 (car pair) (cdr pair)))
14 (cl-remove-if-not (lambda (el) (stringp (car el)))
15 headers)
16 "</tr><tr>")
17 "</tr></table>"))))))
18 9004)