All Projects → elli-lib → Elli

elli-lib / Elli

Licence: mit
Simple, robust and performant Erlang web server

Programming Languages

erlang
1774 projects

Projects that are alternatives of or similar to Elli

Rayo.js
Micro framework for Node.js
Stars: ✭ 170 (-12.37%)
Mutual labels:  performance, http-server, webserver
wine
A lightweight and flexible framework to help build elegant web API
Stars: ✭ 39 (-79.9%)
Mutual labels:  webserver, api-server, http-server
Jennet
A simple HTTP web framework written in Pony
Stars: ✭ 72 (-62.89%)
Mutual labels:  http-server, webserver
Suave
Suave is a simple web development F# library providing a lightweight web server and a set of combinators to manipulate route flow and task composition.
Stars: ✭ 1,196 (+516.49%)
Mutual labels:  http-server, webserver
Ansible Role Haproxy
Ansible Role - HAProxy
Stars: ✭ 112 (-42.27%)
Mutual labels:  performance, webserver
Nico
A HTTP2 web server for reverse proxy and single page application, automatically apply for ssl certificate, Zero-Configuration.
Stars: ✭ 43 (-77.84%)
Mutual labels:  http-server, webserver
Vaxic
Node HTTP server framework
Stars: ✭ 45 (-76.8%)
Mutual labels:  api-server, http-server
Proxy.py
⚡⚡⚡Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging
Stars: ✭ 1,291 (+565.46%)
Mutual labels:  http-server, webserver
Netcoreserver
Ultra fast and low latency asynchronous socket server & client C# .NET Core library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
Stars: ✭ 799 (+311.86%)
Mutual labels:  performance, http-server
Duckrails
Development tool to mock API endpoints quickly and easily (docker image available)
Stars: ✭ 1,690 (+771.13%)
Mutual labels:  apis, api-server
Octane
A web server modeled after express in Rust.
Stars: ✭ 136 (-29.9%)
Mutual labels:  http-server, webserver
Pure Http
✨ The simple web framework for Node.js with zero dependencies.
Stars: ✭ 139 (-28.35%)
Mutual labels:  http-server, webserver
Embedio
A tiny, cross-platform, module based web server for .NET
Stars: ✭ 1,007 (+419.07%)
Mutual labels:  http-server, webserver
Webcpp
用C++开发web服务器框架
Stars: ✭ 23 (-88.14%)
Mutual labels:  http-server, webserver
Aceql Http
AceQL HTTP is a framework of REST like http APIs that allow to access to remote SQL databases over http from any device that supports http.
Stars: ✭ 68 (-64.95%)
Mutual labels:  api-server, http-server
Beetlex
high performance dotnet core socket tcp communication components, support TLS, HTTP, HTTPS, WebSocket, RPC, Redis protocols, custom protocols and 1M connections problem solution
Stars: ✭ 802 (+313.4%)
Mutual labels:  http-server, webserver
Igropyr
a async http server base on libuv for Chez Scheme
Stars: ✭ 85 (-56.19%)
Mutual labels:  http-server, webserver
Iodine
iodine - HTTP / WebSockets Server for Ruby with Pub/Sub support
Stars: ✭ 720 (+271.13%)
Mutual labels:  http-server, webserver
Domtastic
Small, fast, and modular DOM and event library for modern browsers.
Stars: ✭ 763 (+293.3%)
Mutual labels:  modular, performance
Agoo C
Agoo webserver in C.
Stars: ✭ 125 (-35.57%)
Mutual labels:  performance, webserver

elli - Erlang web server for HTTP APIs

Hex.pm Documentation Erlang Common Test Coverage Status MIT License

Elli is a webserver you can run inside your Erlang application to expose an HTTP API. Elli is aimed exclusively at building high-throughput, low-latency HTTP APIs. If robustness and performance is more important than general purpose features, then elli might be for you. If you find yourself digging into the implementation of a webserver, elli might be for you. If you're building web services, not web sites, then elli might be for you.

Elli is used in production at Wooga and Game Analytics. Elli requires OTP 18.0 or newer.

Installation

To use elli you will need a working installation of Erlang 18.0 (or later).

Add elli to your application by adding it as a dependency to your rebar.config:

{deps, [
  %% ...
  {elli, "3.0.0"}
]}.

Afterwards you can run:

$ rebar3 compile

Usage

$ rebar3 shell
%% starting elli
1> {ok, Pid} = elli:start_link([{callback, elli_example_callback}, {port, 3000}]).

Examples

Callback Module

The best source to learn how to write a callback module is src/elli_example_callback.erl and its generated documentation. There are a bunch of examples used in the tests as well as descriptions of all the events.

A minimal callback module could look like this:

-module(elli_minimal_callback).
-export([handle/2, handle_event/3]).

-include_lib("elli/include/elli.hrl").
-behaviour(elli_handler).

handle(Req, _Args) ->
    %% Delegate to our handler function
    handle(Req#req.method, elli_request:path(Req), Req).

handle('GET',[<<"hello">>, <<"world">>], _Req) ->
    %% Reply with a normal response. `ok' can be used instead of `200'
    %% to signal success.
    {ok, [], <<"Hello World!">>};

handle(_, _, _Req) ->
    {404, [], <<"Not Found">>}.

%% @doc Handle request events, like request completed, exception
%% thrown, client timeout, etc. Must return `ok'.
handle_event(_Event, _Data, _Args) ->
    ok.

Supervisor Childspec

To add elli to a supervisor you can use the following example and adapt it to your needs.

-module(fancyapi_sup).
-behaviour(supervisor).
-export([start_link/0]).
-export([init/1]).

start_link() ->
    supervisor:start_link({local, ?MODULE}, ?MODULE, []).

init([]) ->
    ElliOpts = [{callback, fancyapi_callback}, {port, 3000}],
    ElliSpec = {
        fancy_http,
        {elli, start_link, [ElliOpts]},
        permanent,
        5000,
        worker,
        [elli]},

    {ok, { {one_for_one, 5, 10}, [ElliSpec]} }.

Further Reading

For more information about the features and design philosophy of elli check out the overview.

License

Elli is licensed under The MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].