Skip to content
Firmware for combine harvesters written in O'Caml.
C Python Makefile Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
amalgamated
docs/General
example
include
python
src
.gitignore
LICENSE
Makefile
Makefile.vendor
README.md
event_loop_refactor.md
screenshot.png
test_amalgamate.sh

README.md

38-moths

What

Bizarre web framework. Do not be afraid.

Installation

You'll need to install some dependencies. Then you can just:

make
sudo make install

Why

I wanted a minimal, fast webserver/framework thing that I could just install, link with and go. No package management, no weird languages-of-the-week to install, just C. It should be a minimal scaffold to build things off of that I can run in a tmux session ad infinitum. It should have zero dependencies, because its just a webserver. I don't need Boost, a weird allocator, google dependencies or anything else. It's just sockets and bytes and Dennis Ritchie's ghost. It's POSIX.

Usage

#include <string.h>

#include <38-moths/38-moths.h>

int main_sock_fd;

static int index_handler(const http_request *request, http_response *response) {
	const unsigned char buf[] = "Hello, World!";
	response->out = malloc(sizeof(buf));
	memcpy(response->out, buf, sizeof(buf));

	response->outsize = sizeof(buf);
	return 200;
}

static const route all_routes[] = {
	{"GET", "root_handler", "^/$", 0, &index_handler, &heap_cleanup},
};

int main(int argc, char *argv[]) {
	http_serve(&main_sock_fd, 2, all_routes, sizeof(all_routes)/sizeof(all_routes[0]));
	return 0;
}

See the examples directory for more, or check out waifu.xyz for a large example.

Tests

Currently there are only tests for the GRESHUNKEL templating language. The Makefile spits out a greshunkel_test binary that you can run.

You can’t perform that action at this time.