forked from ddrilling/AsbCloudServer
56 lines
1.4 KiB
C#
56 lines
1.4 KiB
C#
|
using AsbCloudInfrastructure;
|
||
|
using Microsoft.AspNetCore.Builder;
|
||
|
using Microsoft.AspNetCore.Hosting;
|
||
|
using Microsoft.Extensions.Configuration;
|
||
|
using Microsoft.Extensions.DependencyInjection;
|
||
|
using Microsoft.Extensions.Hosting;
|
||
|
|
||
|
namespace AsbCloudWebApi
|
||
|
{
|
||
|
public class Startup
|
||
|
{
|
||
|
public Startup(IConfiguration configuration)
|
||
|
{
|
||
|
Configuration = configuration;
|
||
|
}
|
||
|
|
||
|
public IConfiguration Configuration { get; }
|
||
|
|
||
|
public void ConfigureServices(IServiceCollection services)
|
||
|
{
|
||
|
services.AddControllers();
|
||
|
|
||
|
services.AddSwagger(Configuration);
|
||
|
|
||
|
services.AddInfrastructure(Configuration);
|
||
|
|
||
|
services.AddJWTAuthentication(Configuration);
|
||
|
}
|
||
|
|
||
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||
|
{
|
||
|
app.UseSwagger();
|
||
|
app.UseSwaggerUI(c =>
|
||
|
{
|
||
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Charging station V1");
|
||
|
});
|
||
|
|
||
|
if (env.IsDevelopment())
|
||
|
{
|
||
|
app.UseDeveloperExceptionPage();
|
||
|
}
|
||
|
|
||
|
//app.UseHttpsRedirection();
|
||
|
app.UseStaticFiles();
|
||
|
app.UseRouting();
|
||
|
app.UseAuthentication();
|
||
|
app.UseAuthorization();
|
||
|
|
||
|
app.UseEndpoints(endpoints =>
|
||
|
{
|
||
|
endpoints.MapControllers();
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|