<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RailPhase.Demo
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create a simple web app and serve content on to URLs.
            var app = new App();

            // Define the URL patterns
            app.AddUrlPattern("^/$", (request) => new HttpResponse("<h1>Hello World</h1>"));
            app.AddUrlPattern("^/info$", InfoView);

            app.RunTestServer();
        }

        /// <summary>
        /// A view that generates a simple request info page
        /// </summary>
        static HttpResponse InfoView(RailPhase.HttpRequest request)
        {
            // Get the template for the info page.
            var render = Template.FromFile("InfoTemplate.html");

            // Pass the HttpRequest as the template context, because we want
            // to display information about the request. Normally, we would
            // pass some custom object here, containing the information we
            // want to display.
            var body = render(request);

            // Return a simple Http response.
            // We could also return non-HTML content or error codes here
            // by setting the parameters in the HttpResponse constructor.
            return new HttpResponse(body);
        }
    }

    public class DemoContext
    {
        public string Heading;
        public string Username;<commit_msg>Update demo app with more comments<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RailPhase.Demo
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create a simple web app and serve content on to URLs.
            var app = new App();

            // Define the URL patterns to respond to incoming requests.
            // Any request that does not match one of these patterns will
            // be served by app.NotFoundView, which defaults to a simple
            // 404 message.

            // Easiest way to respond to a request: return a string
            app.AddUrlPattern("^/$", (request) => "Hello World");
            // More complex response, see below
            app.AddUrlPattern("^/info$", InfoView);

            // Start listening for HTTP requests. Default port is 8080.
            // This method does never return!
            app.RunTestServer();

            // Now you should be able to visit me in your browser on http://localhost:8080
        }

        /// <summary>
        /// A view that generates a simple request info page
        /// </summary>
        static HttpResponse InfoView(RailPhase.HttpRequest request)
        {
            // Get the template for the info page.
            var render = Template.FromFile("InfoTemplate.html");

            // Pass the HttpRequest as the template context, because we want
            // to display information about the request. Normally, we would
            // pass some custom object here, containing the information we
            // want to display.
            var body = render(context: request);

            // Return a simple Http response.
            // We could also return non-HTML content or error codes here
            // by setting the parameters in the HttpResponse constructor.
            return new HttpResponse(body);
        }
    }

    public class DemoContext
    {
        public string Heading;
        public string Username;
{'fraction_non_alphanumeric': 0.08032240133407449, 'fraction_numerical': 0.003613118399110617, 'mean_word_length': 1.8271798900235663, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '6241450', 'n_tokens_mistral': 854, 'n_tokens_neox': 823, 'n_words': 351}