Advertisement
Danny_Berova

MainApplication

May 28th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using MyWebServer.Application.Controllers;
  5. using MyWebServer.Server.Contracts;
  6. using MyWebServer.Server.Handlers;
  7. using MyWebServer.Server.Routing.Contracts;
  8.  
  9. namespace MyWebServer.Application
  10. {
  11.     public class MainApplication : IApplication
  12.     {
  13.         public void Configure(IAppRouteConfig appRouteConfig)
  14.         {
  15.             appRouteConfig.Get(
  16.                 "/",
  17.                 req => new HomeController().Index());
  18.  
  19.             appRouteConfig.Get(
  20.                 "/testsession",
  21.                 req => new HomeController().SessionTest(req));
  22.  
  23.             appRouteConfig.Get(
  24.                 "/register",
  25.                 req => new UserController()
  26.                     .RegisterGet());
  27.  
  28.             appRouteConfig.Post(
  29.                 "/register",
  30.                 req => new UserController()
  31.                     .RegisterPost(req.FormData["name"]));
  32.  
  33.             appRouteConfig.Get(
  34.                 "/user/{(?<name>[a-z]+)}",
  35.                 req => new UserController()
  36.                     .Details(req.UrlParameters["name"]));
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement