static void HttpServer()
{
listener = new HttpListener();
listener.Prefixes.Add("http://*:5000/");
listener.Start();
while (true)
{
var context = listener.GetContext();
var request = context.Request;
var response = context.Response;
var tw = new StreamWriter(response.OutputStream);
var path = request.Url.AbsolutePath;
if (path.StartsWith("/type/"))
{
ShowInstancesOf(tw, path.Substring(6));
}
else
{
Summary(tw);
}
tw.Flush();
response.OutputStream.Close();
}
}