Project

luna

0.0
The project is in a healthy, maintained state
A tiny, asynchronous static file server with optional Markdown rendering.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 0
~> 0.75
>= 1.30
>= 0.6, < 2.0
~> 2.3
 Project Readme

Luna

A tiny, asynchronous static file server with optional Markdown rendering, built on Protocol::HTTP and Async.

  • Static files via Luna::Middleware::Static
  • Optional Markdown-to-HTML via Luna::Middleware::Markdown (using markly)
  • Simple verbose logging via Luna::Middleware::Verbose

Development Status

Installation

Add this line to your application's Gemfile:

gem "luna"

And then execute:

bundle install

Or install it yourself as:

gem install luna

Usage

Serve the current directory:

luna --bind http://localhost:3000

Options:

  • --root PATH (default: current directory)
  • --index FILENAME (default: index.html)
  • --[no]-directory-listing (default: true)
  • --[no]-markdown (default: true)
  • --[no]-verbose
  • --bind URL (default: http://localhost:3000)

Programmatic Usage

require "async"
require "async/http/endpoint"
require "luna/server"

endpoint = Async::HTTP::Endpoint.parse("http://localhost:3000")
app = Luna::Server.middleware(root: "/path/to/root", markdown: true)

Async do |task|
  server = Luna::Server.new(app, endpoint, protocol: endpoint.protocol)
  server.run
end