<commit_before>
struct MU_DEV_ROUTER

  getter :ctx
  def initialize(@ctx : HTTP::Server::Context)
  end # === def initialize

  def get_homepage
    get_file("root", "main.html")
  end # === def get_root

  def get_file(folder : String, filename : String)
    data = File.read("Public/#{folder}/#{filename}")
    ctx.response.content_type = mime_type(filename)
    ctx.response.content_length = data.bytesize
    ctx.response << data
  end

  def mime_type(filename : String)
    ext = File.extname(filename)
    case ext
    when ".html"
      "text/html"
    when ".css"
      "text/css"
    when ".js"
      "application/javascript"
    else
      "text/plain"
    end
  end # === def mime_type

end # === struct MU_DEV_ROUTER<commit_msg>Improved: file serving for dev.<commit_after>
struct MU_DEV_ROUTER

  @@file_handler = HTTP::StaticFileHandler.new("Public", false, true)

  getter :ctx
  def initialize(@ctx : HTTP::Server::Context)
  end # === def initialize

  def get_homepage
    ctx.request.path = "/root/main.html"
    @@file_handler.call(ctx)
  end # === def get_root

  def get_file(folder : String, filename : String)
    ctx.request.path = ctx.request.path.sub("/megauni/static", "")
    @@file_handler.call(ctx)
  end

end # === struct MU_DEV_ROUTER
{'fraction_non_alphanumeric': 0.1347517730496454, 'fraction_numerical': 0.0, 'mean_word_length': 3.3642611683848798, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3712058', 'n_tokens_mistral': 440, 'n_tokens_neox': 424, 'n_words': 95}