<commit_before>defmodule MyApp1 do
  use Ewebmachine
  
  resource [] do
    to_html do: "<html><body><h1>Hello World</h1></body></html>"
  end

  resource ['coucou'] do
    to_html do: {"<html><body><h1>Hello World</h1></body></html>",_req,_ctx}
  end

  resource ['caca'] do
    to_html do: {"<html><body><h1>Hello World</h1></body></html>",_req,_ctx}
  end

end<commit_msg>complete sample apps<commit_after>defmodule MyApp1 do
  use Ewebmachine
  
  resource [] do
    content_types_provided do: [{'application/json',:to_json},{'text/html',:to_html}]
    to_json do:
      """
      {
        "Hello World":"http://localhost:7171/hello/world",
        "Hello Arnaud":"http://localhost:7171/hello/arnaud",
        "Hello Bonhomme":"http://localhost:7171/hello/bonhomme"
      }
      """
    to_html do:
      """
      <html>
        <body>
          <h1>Menu</h1>
          <ul>
            <li><a href="/hello/world">Hello World</a></li>
            <li><a href="/hello/arnaud">Hello Arnaud</a></li>
            <li><a href="/hello/bonhomme">Hello Bonhomme</a></li>
          </ul>
        </body>
      </html>
      """
  end

  resource ['hello',:name] do
    content_types_provided do: [{'application/json',:to_json},{'text/html',:to_html}]
    to_json do: 
      """
      {
        "coucou": "true",
        "lala": "lolo",
        "name": "#{name(_req)}"
      }
      """
    to_html do: 
      """
      <html>
        <body>
          <h1>Hello #{name(_req)}</h1>
        </body>
      </html>
      """
      def name(req), do: :wrq.path_info(:name,req)
  end

end
{'fraction_non_alphanumeric': 0.19367088607594937, 'fraction_numerical': 0.015189873417721518, 'mean_word_length': 2.2597938144329897, 'pattern_counts': {'":': 6, '<': 47, '<?xml version=': 0, '>': 47, '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': '5765613', 'n_tokens_mistral': 579, 'n_tokens_neox': 567, 'n_words': 95}