Advertisement
Guest User

Untitled

a guest
Feb 4th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GAMBAS 1.01 KB | None | 0 0
  1. namespace netcoredemo
  2.  
  3. open System
  4. open Microsoft.AspNetCore.Builder
  5. open Microsoft.AspNetCore.Hosting
  6. open Microsoft.AspNetCore.Http
  7. open Microsoft.Extensions.DependencyInjection
  8. open Microsoft.Extensions.Configuration
  9. open Microsoft.EntityFrameworkCore
  10. open Microsoft.AspNetCore.Mvc
  11.  
  12. module DB =
  13.     let mutable xs = List.empty
  14.  
  15. type Startup(config : IConfiguration) =
  16.  
  17.     member this.ConfigureServices(services: IServiceCollection) =
  18.         services.AddMvc() <PIPE>> ignore
  19.  
  20.     member this.Configure(app: IApplicationBuilder, env: IHostingEnvironment) =
  21.         app.UseDeveloperExceptionPage() <PIPE>> ignore
  22.         app.UseMvc() <PIPE>> ignore
  23.  
  24.     member this.Configuration = config
  25.  
  26. type CRUD() =
  27.     inherit Controller()
  28.    
  29.     [<Route("Create"); HttpPost>]
  30.     member this.Create() =
  31.         let text = Seq.head this.HttpContext.Request.Headers.["text"]
  32.         DB.xs <- (text :: DB.xs)
  33.         "OK"
  34.  
  35.     [<Route("Read"); HttpGet>]
  36.     member this.Read() =
  37.         DB.xs
  38.         <PIPE>> String.concat "\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement