StatsHelix.Charizard 0.9.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package StatsHelix.Charizard --version 0.9.5
NuGet\Install-Package StatsHelix.Charizard -Version 0.9.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StatsHelix.Charizard" Version="0.9.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add StatsHelix.Charizard --version 0.9.5
#r "nuget: StatsHelix.Charizard, 0.9.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install StatsHelix.Charizard as a Cake Addin
#addin nuget:?package=StatsHelix.Charizard&version=0.9.5

// Install StatsHelix.Charizard as a Cake Tool
#tool nuget:?package=StatsHelix.Charizard&version=0.9.5

StatsHelix.Charizard

The StatsHelix Charizard web framework.

Example

using System;
using System.Net;
using System.Threading.Tasks;

using StatsHelix.Charizard;
using static StatsHelix.Charizard.HttpResponse;

namespace TestApp
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var server = new HttpServer(new IPEndPoint(IPAddress.Loopback, 80), typeof(Program).Assembly);
            // server.UnexpectedException += e => Console.WriteLine(e);
            server.Run().Wait();
        }
    }

    [Controller]
    public class TestController
    {
        // GET /Test/Static HTTP/1.1
        public static HttpResponse Static(HttpRequest req)
        {
            // Return any HttpResult (see that class for what's possible)
            return String("Success.");
        }

        // GET /Test/Sync HTTP/1.1
        public HttpResponse Sync(HttpRequest req)
        {
            // Charizard instantiates one controller object per request for instance actions
            return String("Success.");
        }
        
        // GET /Test/Async HTTP/1.1
        public async Task<HttpResponse> Async(HttpRequest req)
        {
            // Async works
            return await Task.FromResult(String("Success."));
        }
        
        // GET /Test/Params?name=Hi&id=12 HTTP/1.1
        public HttpResponse Params(string name, int id)
        {
            // We can use parameters
            return Json(new FooType { Name = name, Id = id });
            
            // Response:
            // Content-Type: application/json
            // { "Name": "Hi", "Id": 12 }
        }
        
        // POST /Test/Post HTTP/1.1
        // POST-Body: 
        // { "Name": "Hello", "Id": 13 }
        public HttpResponse Post(FooType foo) 
        {
            // Post bodies are JSON-encoded, so they are easy to generate
            // from any client-side language. Deep objects are no problems, 
            // anything that can be handled by Newtonsoft.Json is fine. 
            // We don't support HTML-Forms, since they are - on our opionion - outdated. 
            return String("foo.Name: " + foo.Name + " --- foo.Id: " + foo.Id);
        }
        
        // Dummy type for demonstration
        public class FooType
        {
            public string Name { get; set; }
            public int Id { get; set; }
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.10.3 975 12/29/2018
0.10.2 849 12/29/2018
0.10.1 867 12/27/2018
0.9.5 1,011 2/11/2018
0.9.2 980 7/7/2017
0.9.1 870 7/7/2017
0.9.0 995 5/12/2017

Prerelease (fixed bad packaging)