Skip to content
HTTP server library for janet
Branch: master
Clone or download
Latest commit 26e32f8 Mar 19, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE First Commit. Sep 10, 2018
README.md Update README.md Feb 19, 2019
build.janet
circlet.c Update for latest janet. Mar 19, 2019
circlet_lib.janet
mongoose.c
mongoose.h
testserv.janet

README.md

circlet

Circlet is an HTTP and networking library for the janet language. It provides an abstraction out of the box like Clojure's ring, which is a server abstraction that makes it easy to build composable web applications.

Circlet uses mongoose as the underlying HTTP server engine. Mongoose is a portable, low footprint, event based server library. The flexible build system requirements of mongoose make it very easy to embed in other C programs and libraries.

Building

Building requires janet to be installed on the system.

Use the build.janet script to build like

janet build

Testing

Run a server on localhost with the following command

janet testserv

Example

The below example starts a very simple web server on port 8000.

(import circlet)

(defn myserver 
 "A simple HTTP server"
 [req]
 {:status 200
  :headers {"Content-Type" "text/html"}
  :body "<!doctype html><html><body><h1>Hello.</h1></body></html>"})

(circlet/server 8000 myserver)

License

Unlike janet, circlet is licensed under the GPL license in accordance with mongoose.

You can’t perform that action at this time.