Currently, I am working on a project that involves creating a login page for an admin that redirects to a dashboard. The server-side is built using Express.js, while the client-side utilizes AngularJS.
The AngularJS controller below is used to retrieve data from the login form:
// Angular Controller for handling login form data
(function () {
'use strict';
angular.module("myAdmin", []).controller('loginCtrl', function($scope, $http){
$scope.login = function() {
var userEmail = $scope.user.email;
var userPassword = $scope.user.password;
$http.post('/admin/', {useremail: userEmail, userpassword: userPassword});
}
})
})();
This snippet shows the HTML code for the login page:
<!DOCTYPE html>
<html lang="en" >
<head>
<!-- Head content goes here -->
</head>
<body ng-app="myAdmin">
<!-- Body content goes here -->
</body>
</html>
Furthermore, here is the index.js file that serves as the backend in Express.js:
const express = require('express');
// Server-side functions and routes go here
app.post('/admin/', (req, res) => {
// Handling post requests to '/admin/'
});
If you're interested in exploring the full project, you can visit the GitHub repository here.
I'm currently facing issues with identifying the data sent from the Angular controller to the Express.js post rendering function. If anyone has insights into this problem or suggestions on how to resolve it, your help would be greatly appreciated. It seems like the firebase auth() function is not executing properly.