started api work
This commit is contained in:
parent
6732613466
commit
f9a680c554
3 changed files with 21 additions and 4 deletions
|
|
@ -0,0 +1,15 @@
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SurveyBackend.DTOs;
|
||||||
|
|
||||||
|
namespace SurveyBackend.Controllers;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
[Route("[controller]")]
|
||||||
|
public class AuthController : ControllerBase
|
||||||
|
{
|
||||||
|
[HttpPost("login")]
|
||||||
|
public async Task<IActionResult> GetToken([FromBody] UserLoginDTO loginData)
|
||||||
|
{
|
||||||
|
return Ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,6 @@ namespace SurveyBackend.DTOs;
|
||||||
|
|
||||||
public record UserLoginDTO
|
public record UserLoginDTO
|
||||||
{
|
{
|
||||||
public string Email { get; set; }
|
public required string Email { get; set; }
|
||||||
public string Password { get; set; }
|
public required string Password { get; set; }
|
||||||
}
|
}
|
||||||
|
|
@ -8,6 +8,8 @@ public class Program
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddAuthorization();
|
builder.Services.AddAuthorization();
|
||||||
|
|
||||||
|
builder.Services.AddControllers();
|
||||||
|
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
|
@ -22,10 +24,10 @@ public class Program
|
||||||
app.UseSwaggerUI();
|
app.UseSwaggerUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
|
||||||
|
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
|
app.MapControllers();
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue