BuecherwurmAPI/Startup.cs
Jonas Schönbach d64c4fed67 Squashed commit of the following:
commit d155f8fb5b
Author: Jonas Schönbach <jonas.schoenbach@yahoo.de>
Date:   Wed May 27 15:47:14 2020 +0200

    LendController um DTO ergänzt

commit 4afdb44e92
Author: Jonas Schönbach <jonas.schoenbach@yahoo.de>
Date:   Wed May 27 14:31:46 2020 +0200

    LendController um weitere Methoden ergänzt

commit 1c8ec4b517
Author: Jonas Schönbach <jonas.schoenbach@yahoo.de>
Date:   Wed May 27 11:22:29 2020 +0200

    flexiblere Umsetzung des LendControllers durch Depedency-Injection

commit d07c82f749
Author: Jonas Schönbach <jonas.schoenbach@yahoo.de>
Date:   Wed May 27 10:42:15 2020 +0200

    Überflüssige Dateien entfernt

commit e22296617c
Author: Jonas Schönbach <jonas.schoenbach@yahoo.de>
Date:   Wed May 27 10:38:00 2020 +0200

    Überflüssige Dateien entfernt

commit 774c7be7a9
Author: Jonas Schönbach <jonas.schoenbach@yahoo.de>
Date:   Wed May 27 10:33:53 2020 +0200

    .gitignore-Datei berichtigt

commit f00ecd5034
Author: Jonas Schönbach <jonas.schoenbach@yahoo.de>
Date:   Wed May 27 10:30:19 2020 +0200

    .gitignore-Datei hinzugefügt

commit fbe1e58a47
Author: Jonas Schönbach <jonas.schoenbach@yahoo.de>
Date:   Wed May 27 10:08:52 2020 +0200

    Erster Zwischenstand für die Ausleihe-Schnittstelle (mit Mock-Data)
    api/leihvorgang  -- gibt Liste aller Leihvorgänge zurück
    api/leihvorgang/{id} -- gibt bestimmten Leihvorgang zurück
2020-05-28 10:55:56 +02:00

61 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using BuecherwurmAPI.Data;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace BuecherwurmAPI
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
// Adds a service that is created once per connection.
// It takes an interface and a specific implementation.
// That allows to swap the implementation easily.
services.AddScoped<ILendRepo, MockLendRepo>();
services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseHttpsRedirection();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}