class Syntropy::App

def render_entry(req, entry)

def render_entry(req, entry)
  case entry[:kind]
  when :not_found
    req.respond('Not found', ':status' => Qeweney::Status::NOT_FOUND)
  when :static
    entry[:mime_type] ||= Qeweney::MimeTypes[File.extname(entry[:fn])]
    req.respond(IO.read(entry[:fn]), 'Content-Type' => entry[:mime_type])
  when :markdown
    body = render_markdown(IO.read(entry[:fn]))
    req.respond(body, 'Content-Type' => 'text/html')
  when :module
    call_module(entry, req)
  else
    raise "Invalid entry kind"
  end
end