v hyper.dev · Petit Cloud - 0 - Specification

You may remember the days of html, dynamic or not, php3, funny, and funky under construction 🚧… Ah!… While the visual aesthetic can remain in the past, the ease, and simplicity to create, show, and tell used to be simpler, easier, and more fun. Petit Cloud is a demonstration that the 90s, early 00s workflow can be implemented for fun with our favorite material.

Any resemblance to competitor technology is wholly, and fully coincidental.

Specification

The interface can not be simpler. Given a www.scm with an exported procedure main, it should be possible to do the following:

#;sh> petit-cloud deploy www.example www.scm

Here the intent is to deploy the code of WWW.SCM including dependencies, to WWW.EXAMPLE, both are parameter, and may be changed at will.

At this point jumping to https://www.example/ should display page associated with the root path.

The procedure MAIN is the request handler. It takes as argument the HTTP request parts:

It is expected to return three values:

BODY is always a bytevector. headers is an list mapping a symbol to a string. URL is the complete Universal Ressource Location including scheme, host, path, query string, and fragment as a list. Here is a possible value for URL:

(assert (equal? url (list 'https
                          (list "example" "www")
                          (list "path" "to" "object")
                          (list (cons 'q "freedom"))
                          (list))))

A hello world MAIN can look like:

(define main
  (lambda (method url headers body)
    (match (cons method path)
      (() (values 200
                  '((content-type . "text/plain"))
                  (string->utf8 "Hello schemer!")))
      (else (values 404
                    '((content-type . "text/plain"))
                    (string->utf8 "Nothing here, error 404!"))))))

Furthermore, a couple of procedure should be made available:

Go back, rest, think, and eat your vegetables.

tAll kinds of vegetables that go throught a mixer for the pleasure of people like us