OverviewMotivationIn the beginning of C# web application development, there was ASP.NET Web Forms. It will suffice to say that Web Forms was A Bad Idea. Then Ruby on Rails came along, and it was pretty good for a number of reasons. Obviously it depended on Ruby, and all the things that go with that, good and bad. Later, some folks took the Rails model and made it a C# thing: MonoRail. They had the right idea, but MonoRail still depended on all the crazy ASP.NET/System.Web/IIS stuff, and was itself kind of overbearing and awkward to use. Kayak was born out of frustration with all of this. (It should be noted that since then, Microsoft has released ASP.NET MVC. It’s a marked improvement over Web Forms. It still depends on the System.Web server architecture.) PhilosophySome frameworks claim to be “full stack” or something like that and throw in the kitchen sink. This isn’t one of those frameworks. At its core, the Kayak Framework simply maps HTTP requests to C# method invocations. It provides simple, optional mechanisms to turn a request into arguments to an invocation, and to turn a return value of an invocation into a response. The Kayak Framework currently does not (and probably will not ever) have an official stance on templating, database interaction or session management. In terms of templating, there is code in the repo that provides support for the long-dead and kind of kludgy NVelocity project, and something like NDjango would likely be trivial to plug in. I’ve another (very alpha) project brewing called Flatiron which deals with templating and textual transformations, and when/if Microsoft’s DLR team ships a product, Kayak will support it. You should check out Nick Farina’s excellent PGMapper and LitS3 libraries for all your data-related needs. Session stuff tends to be very application-specific and you probably want to write your own—I’ve made a type-safe, PGMapper-backed session store and access control thingy in about 100 lines. UsageThe framework (Kayak.Framework.dll) depends on the server (Kayak.dll). You must reference both in your project. A basic program which uses Kayak to serve HTTP requests might look like this:
using System;
using Kayak;
using Kayak.Framework;
namespace TestApplication
{
public class EntryPoint
{
public static void Main(string[] args)
{
var server = new KayakServer();
server.UseFramework();
Console.WriteLine(
"Starting Test Application on port {0}",
server.EndPoint.Port);
server.Start();
Console.WriteLine("Press enter to exit.");
Console.ReadLine();
server.Stop();
}
}
class TestService : KayakService
{
[Path("/")]
public void Root()
{
Response.Write("Ahoy-hay from Kayak.");
}
}
}
Aim your favorite HTTP client at |