m7andrew / biplane

A stripped down HTTP/1.1 framework for Janet.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Biplane

logo

Biplane is a stripped down HTTP/1.1 framework for Janet. Biplane is great for small projects or when you want to mix and match libraries. Biplane aims to give you just enough to get off the ground, but leaves the rest to you.

  • PEG Router: The optional router lets you use Janet PEG expressions, giving you fine control over URL matching and what values get captured.
  • Just a Function: The main loop is just a function that takes an HTTP request and returns an HTTP response. There is no middleware complexity to learn, just data to read and modify as you see fit.

See the Wiki for the documentation.

Install

jpm install https://github.com/m7andrew/biplane

Examples

Hello world:

(use biplane)

(defn app [req]
  (res/text "Hello World!"))

(serve app)

Simple routing:

(use biplane)
(use biplane/router)

(defn hello [req name]
  (res/text (string "Hello " name)))

(defn not-found [req]
  (res/text "Not Found" 404))

(def routes
  [(GET '("/hello/" :string) hello)
   (GET '(:any) not-found)])

(defn app [req]
  (route req routes))

(serve app)

About

A stripped down HTTP/1.1 framework for Janet.

License:MIT License


Languages

Language:Clojure 100.0%