Startup.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using JsonRPC4.Builder;
  2. using Microsoft.AspNetCore.Builder;
  3. using Microsoft.AspNetCore.Hosting;
  4. using Microsoft.Extensions.Configuration;
  5. using Microsoft.Extensions.DependencyInjection;
  6. using Microsoft.Extensions.Hosting;
  7. namespace JsonRPC4
  8. {
  9. public class Startup
  10. {
  11. public Startup(IConfiguration configuration)
  12. {
  13. Configuration = configuration;
  14. }
  15. public IConfiguration Configuration { get; }
  16. // This method gets called by the runtime. Use this method to add services to the container.
  17. public void ConfigureServices(IServiceCollection services)
  18. {
  19. services.AddControllers();
  20. services.AddJsonRpc();
  21. }
  22. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  23. public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
  24. {
  25. if (env.IsDevelopment())
  26. {
  27. app.UseDeveloperExceptionPage();
  28. }
  29. app.UseJsonRpc();
  30. app.UseHttpsRedirection();
  31. app.UseRouting();
  32. app.UseAuthorization();
  33. app.UseEndpoints(endpoints =>
  34. {
  35. endpoints.MapControllers();
  36. });
  37. }
  38. }
  39. }