Home

Awesome

Spooky Spooky

Synopsis

Spooky is a lightweight and dead easy to use RESTful request handler for Erlang.

It's using the Misultin http library and provides request handling similar to the Sinatra web framework.

hello_world.erl

    -module(hello_world).
    -behaviour(spooky).
    -export([init/1, get/2]).

    init([])->
        [{port, 8000}].

    get(Req, [])->
        Req:ok("Hello world.");
    get(_, ["smashingpumpkins"])->
        throw({418, "I'm a teapot."});
    get(Req, [Name])->
        Req:ok("Hello world, " ++ Name ++ ".").

shell

    $ make && erlc -pa ebin/ hello_world.erl && erl -pa ebin/ -pa deps/*/ebin
    [...]
    1> spooky:start_link(hello_world)
    {ok, <0.40.0>}
    2> spooky:stop()
    true

Features

Todo

Why?

Scratching an itch. Spooky is as simple as it gets - you're left to deal with everything else than request handling. If this is not what you are looking for and need things like ORM support, templating, etc, you should look at other frameworks:

Thanks

Thanks to Learn you some Erlang, Mochiweb, Misultin and CouchDB for being excellent repositories to learn about Erlang.