Beispiel #1
0
        private static void Main(string[] args)
        {
            var controllerRegistry = new ControllersRegistry();

            controllerRegistry.Reg("Users", new UsersController());
            controllerRegistry.Reg("Categories", new CategoriesController());
            controllerRegistry.Reg("Posts", new PostsController());
            controllerRegistry.Reg("Reviews", new ReviewsController());

            var serializerRegistry = new SerializerRegistry();

            serializerRegistry.RegDefault(new JsonSerializer());
            serializerRegistry.Reg(new List <string> {
                "application/json", "text/json"
            }, new JsonSerializer());
            serializerRegistry.Reg(new List <string> {
                "application/xml", "text/xml"
            }, new XmlSerializer());

            var serv = new TcpServer("127.0.0.1", 8000, serializerRegistry, controllerRegistry);

            serv.Start();
            Console.ReadKey();
        }
Beispiel #2
0
 public HttpServer(ControllersRegistry controllersRegistry, SerializerRegistry serializerRegistry)
 {
     ControllerRegistry = controllersRegistry;
     SerializerRegistry = serializerRegistry;
 }