Skip to content

pepe/circlet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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, as well as the jpm tool (installed by default with latest installs).

jpm build

You can also just run jpm to see a list of possible build commands.

Testing

Run a server on localhost with the following command

jpm test

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 myserver 8000)

License

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

About

HTTP server library for janet

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 100.0%