aboutsummaryrefslogtreecommitdiff
path: root/backend/api/api/Controllers/AuthController.cs
diff options
context:
space:
mode:
authorTAMARA JERINIC <tamara.jerinic@gmail.com>2022-03-09 22:19:17 +0100
committerTAMARA JERINIC <tamara.jerinic@gmail.com>2022-03-09 22:19:17 +0100
commitcbdc861b07e82502664f1c849f141a51104cd3d0 (patch)
tree9959995ea265df2d0be6ff307838a957b813f88e /backend/api/api/Controllers/AuthController.cs
parent8e7f2346cc4507b7e8056b57e01c0e85c11a4a2c (diff)
parenta95a921478435cc6400236d291281c3d0156a7e1 (diff)
Merge branch 'dev' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into microservice
Diffstat (limited to 'backend/api/api/Controllers/AuthController.cs')
-rw-r--r--backend/api/api/Controllers/AuthController.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/backend/api/api/Controllers/AuthController.cs b/backend/api/api/Controllers/AuthController.cs
new file mode 100644
index 00000000..01354f87
--- /dev/null
+++ b/backend/api/api/Controllers/AuthController.cs
@@ -0,0 +1,36 @@
+using api.Models.Users;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using api.Services;
+using Microsoft.AspNetCore.Authorization;
+
+namespace api.Controllers
+{
+ [Route("api/[controller]")]
+ [ApiController]
+ public class AuthController : ControllerBase
+ {
+ private IAuthService _auth;
+ public AuthController(IAuthService auth)
+ {
+ _auth = auth;
+ }
+
+ [HttpPost("register")]
+ public async Task<ActionResult<string>> Register(RegisterRequest user)
+ {
+
+ return Ok(_auth.Register(user));
+ }
+
+ [HttpPost("login")]
+ public async Task<ActionResult<string>> Login(AuthRequest user)
+ {
+
+ return Ok(_auth.Login(user));
+ }
+
+
+
+ }
+}