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:52 +0100
committerTAMARA JERINIC <tamara.jerinic@gmail.com>2022-03-09 22:19:52 +0100
commit1ef8894a7ae00ce8c4ded39c82b4c43993cfa923 (patch)
treeea835844fb6acb404806af9d7768f6fc5c0109c4 /backend/api/api/Controllers/AuthController.cs
parent2f67bfab8ecc3d565a6940226bd9d42c1a85159b (diff)
parenta95a921478435cc6400236d291281c3d0156a7e1 (diff)
Merge branch 'dev' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into dev
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));
+ }
+
+
+
+ }
+}