aboutsummaryrefslogtreecommitdiff
path: root/backend/api/api/Controllers/AuthController.cs
diff options
context:
space:
mode:
authorDanijel Andjelkovic <adanijel99@gmail.com>2022-03-07 19:16:23 +0100
committerDanijel Andjelkovic <adanijel99@gmail.com>2022-03-07 19:16:23 +0100
commit5e13228f88cc0be48b12809c73b97eff50ce8bf1 (patch)
treed7bc74fb4ae85256e36352ed9b62e3e7ab58c0e8 /backend/api/api/Controllers/AuthController.cs
parent9eb7f0dd8c22782fed9ccf96fbfec3cedff2b892 (diff)
parentb2e87a1085eee4bb60eb1db9abb29dd83118ac5a (diff)
Merge branch 'backend' 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.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));
+ }
+
+
+ }
+}