Next: , Previous: , Up: Usage Examples   [Contents][Index]


4.3 Hello World HTML

;;; hello-world-html.el --- html hello world server using Emacs Web Server
(ws-start
 (lambda (request)
   (with-slots (process headers) request
     (ws-response-header process 200 '("Content-type" . "text/html"))
     (process-send-string process "<html>
  <head>
    <title>Hello World</title>
  </head>
  <body>
    <b>hello world</b>
  </body>
</html>")))
 9002)

This variation of the “hello world” example sends a text/html response instead of a simple text/plain response.