Created
October 5, 2011 13:33
-
-
Save Vidarls/1264433 to your computer and use it in GitHub Desktop.
Super naive nancy stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>Events</title> | |
</head> | |
<body> | |
<h1>Events</h1> | |
<table> | |
<thead> | |
<tr> | |
<th>Id</th> | |
<th>Data</th> | |
</tr> | |
</thead> | |
<tbody> | |
@Each | |
<tr> | |
<td>@Current.Id</td> | |
<td>@Current.Data</td> | |
</tr> | |
@EndEach | |
</tbody> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Starting..."); | |
var host = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:80/"), | |
new DefaultNancyBootstrapper()); | |
host.Start(); | |
Console.WriteLine("Started."); | |
Console.WriteLine("Enter to exit."); | |
Console.ReadLine(); | |
host.Stop(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Events : NancyModule | |
{ | |
public Events() : base("events") | |
{ | |
Get["/"] = (_) => | |
{ | |
var db = Database.Open("SomeConnectionString"); | |
var events = db.Events.All().OrderByIdDescending(); | |
return View["EventList", events]; | |
}; | |
} | |
} |
serialseb
commented
Oct 5, 2011
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment