Skip to content

thomasmulvaney/http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTP

A basic http server for pixie.

Usage

(ns skynet.core
  (:require [http.server :as server]))

(defn my-handler [req]
  (println "Received a request")
  {:status 200
   :phrase "OK"
   :protocol "HTTP/1.1"
   :body (str "<h1>You are visiting " (req :location) "</h1>")})
   
(server/start "127.0.0.1" 4000 my-handler) 

A handler is a function which accepts a request map and returns a response map.

The request map contains :location, :method, :protocol and :headers keys. The :headers key contains a map of HTTP headers. The response map must have :status, :phrase and :protocol keys set. :body should be a string.

An example web server is located under examples/ and can be run with dust run examples/simple.pxi.

About

A HTTP server for Pixie

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages