aboutsummaryrefslogtreecommitdiff
path: root/backend/api/api/Controllers/AuthController.cs
diff options
context:
space:
mode:
authorDanijel Andjelkovic <adanijel99@gmail.com>2022-03-07 18:58:50 +0100
committerDanijel Andjelkovic <adanijel99@gmail.com>2022-03-07 18:58:50 +0100
commitb2e87a1085eee4bb60eb1db9abb29dd83118ac5a (patch)
tree0f89e7a58947a8d6ca693c90ef8a3cca41d4f057 /backend/api/api/Controllers/AuthController.cs
parent82e3539f71e9a13ff5b1a0f63e2bd9bc1588344c (diff)
parent716754330e70a61ed0cb119d24a54e7bc7b4736b (diff)
Merge branch 'backend-auth' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into backend
# Conflicts: # backend/api/api/appsettings.json
Diffstat (limited to 'backend/api/api/Controllers/AuthController.cs')
-rw-r--r--backend/api/api/Controllers/AuthController.cs34
1 files changed, 34 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..1f47067f
--- /dev/null
+++ b/backend/api/api/Controllers/AuthController.cs
@@ -0,0 +1,34 @@
+using api.Models.Users;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using api.Services;
+
+namespace api.Controllers
+{
+ [Route("api/[controller]")]
+ [ApiController]
+ public class AuthController : ControllerBase
+ {
+ private AuthService _auth;
+ public AuthController(IConfiguration configuration)
+ {
+ _auth=new AuthService(configuration);
+ }
+
+ [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));
+ }
+
+
+ }
+}