From 37aa4268b4b089b37d41c728dbb0327e4ce41dc3 Mon Sep 17 00:00:00 2001
From: xfarrow
Date: Wed, 18 Oct 2023 13:03:41 +0200
Subject: [PATCH] First registering code
---
backend/apis/nodejs/api.js | 3 +
frontend/html/constants.js | 1 +
.../css/{login.css => login-register.css} | 6 +-
frontend/html/html/login.html | 4 +-
frontend/html/html/register.html | 69 +++++++++++++++++++
5 files changed, 78 insertions(+), 5 deletions(-)
create mode 100644 frontend/html/constants.js
rename frontend/html/css/{login.css => login-register.css} (97%)
create mode 100644 frontend/html/html/register.html
diff --git a/backend/apis/nodejs/api.js b/backend/apis/nodejs/api.js
index 88b71e2..fa62a08 100644
--- a/backend/apis/nodejs/api.js
+++ b/backend/apis/nodejs/api.js
@@ -12,11 +12,14 @@
*/
const express = require('express');
+const cors = require('cors');
const api_controller = require('./api_controller.js');
require('dotenv').config();
const app = express();
app.use(express.json()); // Middleware which parses JSON for POST requests
+// Enable CORS for all routes
+app.use(cors());
app.post('/blinkapi/register', api_controller.registerPerson); // Register a Person
app.post('/blinkapi/login', api_controller.login); // Login
app.get('/blinkapi/person/:id', api_controller.verifyToken, api_controller.getPerson); // Obtain Person's details
diff --git a/frontend/html/constants.js b/frontend/html/constants.js
new file mode 100644
index 0000000..06efcb3
--- /dev/null
+++ b/frontend/html/constants.js
@@ -0,0 +1 @@
+const apiUrl = "http://localhost:3000/blinkapi";
\ No newline at end of file
diff --git a/frontend/html/css/login.css b/frontend/html/css/login-register.css
similarity index 97%
rename from frontend/html/css/login.css
rename to frontend/html/css/login-register.css
index 7cce9d5..2d8fa7c 100644
--- a/frontend/html/css/login.css
+++ b/frontend/html/css/login-register.css
@@ -48,7 +48,7 @@ a:active:hover {
padding: 0 60px;
}
-input {
+input, button {
display: block;
box-sizing: border-box;
width: 100%;
@@ -130,7 +130,7 @@ input[type="email"]:valid ~ .validation span:last-child {
top: 0px;
}
-input[type="submit"] {
+button[type="button"] {
border: none;
display: block;
background-color: #3ca9e2;
@@ -146,7 +146,7 @@ input[type="submit"] {
cursor: pointer;
text-align: center;
}
-input[type="submit"]:hover {
+button[type="button"]:hover {
background-color: #329dd5;
-webkit-transition: all 0.2s ease;
transition: all 0.2s ease;
diff --git a/frontend/html/html/login.html b/frontend/html/html/login.html
index 2af5964..0fac469 100644
--- a/frontend/html/html/login.html
+++ b/frontend/html/html/login.html
@@ -4,7 +4,7 @@
HTML5 Login Form with validation Example
-
+
@@ -26,7 +26,7 @@
diff --git a/frontend/html/html/register.html b/frontend/html/html/register.html
new file mode 100644
index 0000000..3eaf329
--- /dev/null
+++ b/frontend/html/html/register.html
@@ -0,0 +1,69 @@
+
+
+
+
+ HTML5 Login Form with validation Example
+
+
+
+
+
+
+
+
+
+
+
+