Skip to content

lfe-mug/lmug-yaws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lmug-yaws

An lmug adapter that uses the YAWS embedded web server

Introduction

This is a module for running a YAWS embedded server as an lmug adapter.

Installation

Just add it to your rebar.config deps:

    {deps, [
        ...
        {lmug-yaws, ".*", {git, "git@github.com:lfex/lmug-yaws.git", "master"}}
      ]}.

And then do the usual:

    $ rebar get-deps
    $ rebar compile

Usage

NOTE: the example below does not yet work; this lmud adapter is a work in progress.

Hello World

> (slurp "src/lmug-yaws.lfe")
#(ok lmug-yaws)
> (defun handler (request)
    (make-response
      status 200
      headers '(#(content_type "text/plain"))
      body "Hello World"))
handler
> (run-yaws #'handler/1)
#(ok <0.55.0>)

To check your new hanlder:

$ curl -D- -X GET http://localhost:1206/
HTTP/1.1 200 OK
Server: inets/5.10.2
Date: Thu, 28 Aug 2014 20:30:52 GMT
Content-Length: 11
Content-Type: text/plain

Hello World

If you want to run on a non-default port (or pass other options) or if you are using with other projects, please use the adapter module directly. For example:

(lmug-yaws-adapter:run #'handler/1 '(#(port 8000)))
#(ok <0.54.0>)

About

An lmug Adapter for the YAWS Web Server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published