I’ve made a way for a user to create a username/password, and I think I’ve figured out how to make them log in. Here is the code:
And here is the page where I redirect signed in users.
I believe you are looking for an authentication logic implementation.
It seems like you use express for backend and render the frontend in the backend server.
createUserTable only creates the visual form for login, it has nothing to do with the authentication system.
If you simply want to display a signed-in page after pressing sign in button for mocking, then in the backend
GET /log-in endpoint, after where you authenticate the user, redirect user to the signed-in page or the corresponding html string.
If you are implementing a stateful app that the backend persistently stores the user session status (ie the system knows whether a user signs in), you’ll have to store information like the logged in time, expiry date, ip address etc in a database, and send a cookie token to the frontend so that user can request service (eg sign out) with the token, depending on the security and performance requirements.
I’d suggest you to refer to some tutorials with the tools you are using for a quick beginner implementation. Here’s one from Jason Watmore blog
Answered By – ChopSuey
Answer Checked By – Gilberto Lyons (AngularFixing Admin)